[Solved] Need the words between the ” – ” ONLY string splitting [duplicate]

So basically you to first split by – and then each side by a non-word character. Therefore you can try: String s = “ABC_DEF-HIJ (KL MNOP_QRS)”; String[] splits = s.split(“-“); // {“ABC_DEF”, “HIJ (KL MNOP_QRS)”} String[] lefts = split[0].split(“[^a-zA-Z]”); // {“ABC”, “DEF”} String[] rights = split[1].split(“[^a-zA-Z]”); // {“HIJ”, “”, “KL”, “MNOP”, “QRS”} String string1 = … Read more

[Solved] In C++ why does reference to single character of std::string give a number [closed]

On my Debian/Sid/x86-64 the below program (in source file itsols.cc compiled with the command g++ -Wall itsols.cc -o itsols) #include <iostream> #include <string> int main(int, char**) { std::string s = “Hello”; std::cout << s[3] << std::endl; return 0; } displays a single lower-case l (compiled with g++ -Wall itsols.cc -o itsols, both with GCC 4.7.2 … Read more

[Solved] How take the string between two symbols c#? [closed]

I’m not sure if this matches what you need but you could try: var myString = “!re=.id=2CB=name=xxname123=service=vpn=caller-id=”; var match = new Regex(@”\.id=(?<value>[^=]*)=”).Match(myString); var id = match.Groups[“value”].Value; I haven’t tested this for specific syntax, but that should get you just that captured string. You can modify that to iterate across a MatchCollection if you need to … Read more

[Solved] Replacing a substring with given form with another in C#

Basically: take the pattern (containing 3 groups), replace instr with second group from pattern. private string MyReplace(string inStr, string leaveStr) { string pattern = @”(.*?)(” + leaveStr + “)(.*)”; string repl = @”*$2*”; Regex rgx = new Regex(pattern); return rgx.Replace(inStr, repl); } string x = MyReplace(@”\textbf\{atext\}”, “atext”); x = MyReplace(@”\textbf\{1\}”, “1”); full string – group … Read more

[Solved] Using substring in line C# [closed]

It means that the values you are passing to Substring are not valid for the string they are being called on. For example: string s = “hello”; string x = s.Substring(0, 1); // <– This is fine (returns “h”) string y = s.Substring(1, 3); // <– Also fine (returns “ell”) string z = s.Substring(5, 3); … Read more