mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.9.3.1
This commit is contained in:
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.pfuncs.stringutils; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_count extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_strx_count;}
|
||||
@@ -32,8 +33,8 @@ public class Pfunc_count extends Pf_func_base {
|
||||
int pos = 0;
|
||||
int rv = 0;
|
||||
while (true) {
|
||||
int find_pos = Bry_finder.Find_fwd(src, find, pos, src_len);
|
||||
if (find_pos == Bry_finder.Not_found) break;
|
||||
int find_pos = Bry_find_.Find_fwd(src, find, pos, src_len);
|
||||
if (find_pos == Bry_find_.Not_found) break;
|
||||
pos = find_pos + find_len;
|
||||
++rv;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.pfuncs.stringutils; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_explode extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_strx_explode;}
|
||||
@@ -49,8 +50,8 @@ public class Pfunc_explode extends Pf_func_base {
|
||||
int src_len = src.length; int dlm_len = dlm.length;
|
||||
int pos = 0; int found = 0;
|
||||
while (true) {
|
||||
int find_pos = Bry_finder.Find_fwd(src, dlm, pos);
|
||||
if (find_pos == Bry_finder.Not_found) break;
|
||||
int find_pos = Bry_find_.Find_fwd(src, dlm, pos);
|
||||
if (find_pos == Bry_find_.Not_found) break;
|
||||
if (found == idx) return Bry_.Mid(src, pos, find_pos);
|
||||
pos = find_pos + dlm_len;
|
||||
++found;
|
||||
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.pfuncs.stringutils; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_len extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_strx_len;}
|
||||
@@ -23,7 +24,7 @@ public class Pfunc_len extends Pf_func_base {
|
||||
@Override public boolean Func_require_colon_arg() {return true;}
|
||||
@Override public void Func_evaluate(Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Bry_bfr trg) {
|
||||
byte[] str = Eval_argx(ctx, src, caller, self);
|
||||
int char_count = gplx.intl.Utf8_.Len_of_bry(str);
|
||||
int char_count = gplx.core.intls.Utf8_.Len_of_bry(str);
|
||||
trg.Add_int_variable(char_count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.pfuncs.stringutils; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_pos extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_strx_pos;}
|
||||
@@ -27,8 +28,8 @@ public class Pfunc_pos extends Pf_func_base {
|
||||
byte[] find = Pf_func_.Eval_arg_or(ctx, src, caller, self, self_args_len, 0, Byte_ascii.Space_bry); // MW: use " " if find is missing
|
||||
byte[] offset_bry = Pf_func_.Eval_arg_or(ctx, src, caller, self, self_args_len, 1, null);
|
||||
int offset = offset_bry == null ? 0 : Bry_.To_int_or_neg1(offset_bry);
|
||||
int pos = Bry_finder.Find_fwd(str, find, offset);
|
||||
if (pos != Bry_finder.Not_found)
|
||||
int pos = Bry_find_.Find_fwd(str, find, offset);
|
||||
if (pos != Bry_find_.Not_found)
|
||||
trg.Add_int_variable(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.pfuncs.stringutils; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_replace extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_strx_replace;}
|
||||
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.pfuncs.stringutils; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_rpos extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_strx_rpos;}
|
||||
@@ -27,8 +28,8 @@ public class Pfunc_rpos extends Pf_func_base {
|
||||
byte[] find = Pf_func_.Eval_arg_or(ctx, src, caller, self, self_args_len, 0, Byte_ascii.Space_bry); // MW: use " " if find is missing
|
||||
byte[] offset_bry = Pf_func_.Eval_arg_or(ctx, src, caller, self, self_args_len, 1, null);
|
||||
int offset = offset_bry == null ? str.length : Bry_.To_int_or_neg1(offset_bry);
|
||||
int pos = Bry_finder.Find_bwd(str, find, offset);
|
||||
if (pos == Bry_finder.Not_found) pos = -1;
|
||||
int pos = Bry_find_.Find_bwd(str, find, offset);
|
||||
if (pos == Bry_find_.Not_found) pos = -1;
|
||||
trg.Add_int_variable(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.pfuncs.stringutils; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_sub extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_strx_sub;}
|
||||
|
||||
@@ -16,6 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.pfuncs.stringutils; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
|
||||
import gplx.xowa.langs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.tmpls.*;
|
||||
public class Pfunc_urldecode extends Pf_func_base {
|
||||
@Override public int Id() {return Xol_kwd_grp_.Id_strx_urldecode;}
|
||||
|
||||
Reference in New Issue
Block a user