我想在java中乱码一个数组,但不是为了更改原始列表,只是将临时列表洗牌.
我写了这样的东西.
ArrayList<TristateCheckBox> tempList = buttons;
Collections.shuffle(tempList);
Run Code Online (Sandbox Code Playgroud)
但这不是shuffles只有tempList也会改变按钮列表.
如何使用AppleScript获取已安装语音的列表?我看到前段时间使用了:"告诉应用程序声音"或查看目录"/ System/Library/Speech/Voices /"中的文件,但似乎这些方法不再起作用了.
我想验证一个数字字符串,该字符串必须只包含400到550之间的数字.
$x = "401"; // valid
$x = "551"; // invalid
Run Code Online (Sandbox Code Playgroud)
我想只匹配400到550之间的数字.
我尝试了以下模式:
if(preg_match_all("/[400-550]+/",$x));
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
匹配数字400-550的正则表达式是什么?
如何匹配900到950之间的数字?
我有以下正则表达式匹配数字900-950:
/9[0-5][0-9]{3}/
Run Code Online (Sandbox Code Playgroud)
但它也匹配955字符串,
如何修复它以匹配直到900到950?
我正在尝试更改字符串中文本的颜色:
我的字符串:
$message="I have a [red][car]";
Run Code Online (Sandbox Code Playgroud)
我想捕获第一个[...]和第二个[...]内的值,然后使用它
<b style='color:color'>car</b>
Run Code Online (Sandbox Code Playgroud)
根据第一个[...]的值更改文本颜色
到目前为止,我有:
echo preg_replace("/\[([^\]]+)\]\[([^\]+])\]/i","<b style='color:$1'>$2</b>",$message);
Run Code Online (Sandbox Code Playgroud)
但它不起作用,orignal字符串作为输出返回.我不知道我的正则表达式失败了.
请帮忙!
我有一个字符串,其中包含一些由新行分隔的子字符串.
例如 :
$x="This is the first line.
This is the second line.
This is the third line.";
Run Code Online (Sandbox Code Playgroud)
我想从这个字符串中获取第三行,
到目前为止我的正则表达式:
/\s*([^\n]+)/i
Run Code Online (Sandbox Code Playgroud)
但这会返回整个字符串,
我也试过了
/\n{3}\s*([^\n]+)/i
Run Code Online (Sandbox Code Playgroud)
它没有任何匹配.
正则表达式有什么方法可以解决我的问题吗?在过去的30分钟里,我一直在努力解决这个问题,但我的所有尝试都失败了.
preg_match_all("/\s*([^\n]+)/i",$x,$m);
print_r($m);
Run Code Online (Sandbox Code Playgroud)
谢谢!
如果没有 GET=action 或 POST=action,我需要 htaccess 重写来阻止请求。
如果有人跑
example.com/wp-admin/admin-ajax.php
Run Code Online (Sandbox Code Playgroud)
然后他会看到错误 404。
我认为这应该可以重写,但我不知道这是如何工作的:
RewriteRule ^wp-admin/admin-ajax.php$ index.php [L,QSA]
Run Code Online (Sandbox Code Playgroud) 我有以下段落:
This is the first line.
this is the second line.
we live in Europe.
this is the fourth line.
Run Code Online (Sandbox Code Playgroud)
我想将第一个字符转换为 uppercase每个换行符.
因此该段落应如下所示:
This is the first line.
This is the second line.
We live in Europe.
This is the fourth line.
Run Code Online (Sandbox Code Playgroud)
到目前为止,我能够将第一个字符转换为大写,但它会转换每个单词中的第一个字符,而不是使用 ucfirst()和 ucword()
echo ucfirst($str);
Run Code Online (Sandbox Code Playgroud)
有没有办法解决这个使用 ucfirst()或 preg_replace()功能?
谢谢!
我正在尝试从我的消息字符串中删除 html 标签。
我有以下包含用户输入的字符串:
$msg="<a href="#">Hello world</a> ! <b>Welcome to venga club</b> .<br><li>We are here to entertain you....</li>";
Run Code Online (Sandbox Code Playgroud)
我知道使用 regex 和 preg_replace 删除这些标签很简单,但如果可能的话,我想使用 strip_tags() 来执行此操作。
我尝试了以下代码
echo strip_tags("<a><b><li><br>",$msg);
Run Code Online (Sandbox Code Playgroud)
但我得到的结果是黑色的,函数有问题吗?非常感谢任何帮助。
谢谢
我正在尝试使用xdiff_string_diff()函数来查找新旧字符串之间的差异,如下所示:
$old_str="Hello world";
$edited_str="Hello ladies!";
echo xdiff_string_diff($old_str,$edited_str,1);
Run Code Online (Sandbox Code Playgroud)
我的服务器返回了致命错误:
Call to an undefined function
Run Code Online (Sandbox Code Playgroud)
我的php版本是5.4 *
可能是什么问题?
我需要在服务器上安装一些东西才能使此功能正常工作吗?
请帮忙!
php ×7
regex ×4
.htaccess ×1
admin-ajax ×1
applescript ×1
arraylist ×1
java ×1
preg-replace ×1
shuffle ×1
wordpress ×1