标签: substring

C++ 11正则表达式子串匹配

我正在寻找C++ 11中的正则表达式,它可以匹配字符串中的子字符串.

类似的东西: "It´s a dark night out there..."我正在寻找ark

因此,如果子字符串位于字符串中的某个位置,则此表达式应匹配.此外,我想可以选择说这个匹配应该区分大小写.

我已经尝试过了,但似乎没有用......

string str = "It´s a dark night out there...";
regex ex ("ark"); 
if (regex_match (str,ex))
    cout << "Match found!";
Run Code Online (Sandbox Code Playgroud)

有人知道这样的事吗?

c++ regex string substring c++11

1
推荐指数
1
解决办法
4603
查看次数

Java:字符串操作.获取URL中的最后一个子路径

让我说我有一个URL http://example.com/files/public_files/test.zip,我想提取最后一个子路径,所以test.zip,我怎么能这样做?

我来自Python,所以我还是Java和学习的新手.在Python中你可以这样做:

>>> x = "http://example.com/files/public_files/test.zip"
>>> x.split("/")[-1]
'test.zip'
Run Code Online (Sandbox Code Playgroud)

java string split substring

1
推荐指数
1
解决办法
826
查看次数

在javascript中设置子字符串的样式

嗨,我想尝试用javascript设置子字符串.这是我的代码:

function runtest(){
    document.getElementById("test1").innerHTML.substring(0,2).style.fontStyle="italic";
}
Run Code Online (Sandbox Code Playgroud)

子字符串函数有效,但是当我添加样式时,错误控制台会给出错误"undefined".如何使用javascript设置此子字符串的样式?

javascript styles substring

1
推荐指数
1
解决办法
732
查看次数

在C#aspx页面上使用子字符串

我正在尝试使用子字符串,以便在我的aspx母版页上获取日期的特定部分.我需要这个的原因与我下载的模板和它背后的CSS有关.这是我得到的代码:

<span><%= DateTime.Today.ToString("M").Substring(3), ((int)(DateTime.Today.ToString("M").Length) - 2) %></span>
Run Code Online (Sandbox Code Playgroud)

我需要选择当前月份,以便前3个字符位于第一个跨度中,其余字符位于第二个跨度中.我需要减去2的原因是因为它增加了之后一个月的日期.

预先感谢您的任何帮助.

c# asp.net substring

1
推荐指数
1
解决办法
864
查看次数

如何删除oracle中的随机子字符串

我需要你对给定问题的帮助

我有一个带有列工人的表,它提供了数据

thorax1 [00400-00479] head1 [00100-00228] lab66 [lab661]

the whole date is in single column

我们有一个页面,我们可以命令删除任何给定的字符串.

为了删除记录,我们只给出方括号中的代码.

例如,如果我们需要删除 head1 [00100 - 00228],我们只给00100 - 00228删除字符串.

这里我的问题是写一个查询,我们可以给00100 - 00228或00400 - 00479删除head1 [00100 - 00228]或thorax1 [00400 - 00479] 记录.

oracle substring oracle10g

1
推荐指数
1
解决办法
95
查看次数

如何使用整数值作为分隔符进行爆炸

我在这样的PHP中得到一个字符串值 -

How are you|1 I am fine|2 That is fine|3
Run Code Online (Sandbox Code Playgroud)

我想将此字符串分隔符转换为此整数值.基本上我需要这3个值.

How are you|1 
I am fine|2 
That is fine|3
Run Code Online (Sandbox Code Playgroud)

任何人都可以建议我能做些什么.

php substring explode delimiter

1
推荐指数
1
解决办法
223
查看次数

在最后一次斜线后削减子串?

如何在javascript中删除字符串中的子字符串(在最后一次斜杠之后)

c:/ Program File/Internet Explorer

至

c:/程序文件/

javascript regex substring

1
推荐指数
2
解决办法
866
查看次数

带有空和子串的Java序列化

看看实施情况,但未能想到对此的解释,但也许有人会知道.

public static void main(String[] args) throws Exception {
    List<String> emptyStrings = new ArrayList<String>();
    List<String> emptySubStrings = new ArrayList<String>();
    for (int i = 0; i < 20000; i++) {
        String actuallyEmpty = "";
        String subStringedEmpty = "                                                                 ";
        subStringedEmpty = subStringedEmpty.substring(0, 0);
        emptyStrings.add(actuallyEmpty);
        emptySubStrings.add(subStringedEmpty);
    }
    System.out.println("Substring test");
    // Write to files
    long time = System.currentTimeMillis();
    writeObjectToFile(emptyStrings, "empty.list");
    System.out.println("Time taken to write empty list " + (System.currentTimeMillis() - time));
    time = System.currentTimeMillis();
    writeObjectToFile(emptySubStrings, "substring.list");
    System.out.println("Time taken to write substring list " …
Run Code Online (Sandbox Code Playgroud)

java string serialization substring

1
推荐指数
1
解决办法
389
查看次数

从字符串中获取2个字符

我有一个字符串FILENAME,实际上在foreach循环中保存文件名.字符串将是这样的:

MyFile_TEST_INDIA_20160728
MyFile_TEST_AMERICA_20160728    
MyFile_TEST_GERMANY_20160728
Run Code Online (Sandbox Code Playgroud)

我需要获取国家/地区名称的前2个字符.我试过以下:

String rmtdir = Filename.substring(Filename.length() - 12, Filename.length() - 12);
System.out.println(rmtdir); 
Run Code Online (Sandbox Code Playgroud)

但通过使用它,我只能获得INDIA所需的数据.
对于其他国家/地区,我手动需要更新子字符串的第二部分,并考虑到国家/地区的扩展长度.

像美国和德国一样:

String rmtdir = Filename.substring(Filename.length() - 12, Filename.length() - 14);
Run Code Online (Sandbox Code Playgroud)

有没有办法转到起始索引并选择要选择的职位数?

java string substring talend

1
推荐指数
1
解决办法
1789
查看次数

在C中传递子字符串

我昨晚花了很多时间调试这段代码.我有两个数据文本文件,都包含18000个字符.我想将这些18000分成两个子串,每个子串100个,这使得180次迭代.

棘手的是,在前180次迭代中,两个子串的大小都很好.在18次迭代之后,子串的大小为0.

两个文件都正确打开.我可以打印它们等等.我尝试以我能想到的所有可能方式分配子字符串,但到目前为止找不到解决方案.

int main(int argc, char const *argv[]) { 

    //Ive loaded two files into two strings buff1 and buff2 both size of 18000 chars
    //It works fine with small data example, I dunno why but eventually I have work with much more bigger data set
    //Id like to divide them into 100 char long pieces and do some stuff with that 

    char *substrA;      //substring for buff1
    char *substrB;      //substring for buff2

    substrA = malloc((wlen+1)*sizeof(char));        //word length wlen=100
    substrA = …
Run Code Online (Sandbox Code Playgroud)

c string substring

1
推荐指数
1
解决办法
91
查看次数

标签 统计

substring ×10

string ×5

java ×3

javascript ×2

regex ×2

asp.net ×1

c ×1

c# ×1

c++ ×1

c++11 ×1

delimiter ×1

explode ×1

oracle ×1

oracle10g ×1

php ×1

serialization ×1

split ×1

styles ×1

talend ×1