S
S
sidor_tank2019-03-16 21:04:41
C++ / C#
sidor_tank, 2019-03-16 21:04:41

How to split a string by 2 characters \\(file path)?

How to split a string by 2 characters \\(file path)? Using Regex or regular Split.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
#
#, 2019-03-16
@sidor_tank

\\(the path to the file)
this is the syntax of literals in the program text, so that the compiler would distinguish between the use of \ as a service character and as a simple character. in fact, the path strings contain a single delimiter character \
, so you need to split it exactly on it. although written as '\\'. but it's one character
also look at the Path class https://docs.microsoft.com/en-us/dotnet/api/system...
sometimes it's enough to highlight a path without a name, a filename, a name without an extension, or an extension without a name

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question