I have a string say "ABC++SXR++DUMMY.png" its a file name here, i need to split the string with the delimiter '++' so i have done it in a simple way i.e.
which gives me an array containing [ABC,SXR,DUMMY.png] here, i want like [ABC,SXR,DUMMY] without the extension part. What would be the regex for achieving the same or should i be doing again the substring on it to remove the .ext from the list?
It would be possible to do it as part of the split but I would remove the extension before the split.
That line of code cannot be the line you are using since the regex does not have quotes round it and you should be using "\\" and not "//" ! Also, if you did use "\\++" this would split
The original poster hasn't been answering the questions that have been asked, so I don't think we really know the requirements. However, the original question said that '++' was the delimiter, suggesting that the number of + signs is not arbitrary, and a single '+' should not be considered a delimiter. If that's the case, then the correct regex would be
Have you run this code by yourself?
In this case any number will be as a delimiter. Also double ++ makes redundant empty strings because it doesn't recognize ++ as a single delimiter (it is 2 separate delimiters).
Also, what if extension is in upper case?
Well don't expect me to do the dishes! This ad has been cleaned for your convenience:
Gift giving made easy with the permaculture playing cards