Search:
Forum
General C++ Programming
Hyphens and dashes difference?
Hyphens and dashes difference?
Dec 22, 2019 at 10:01pm UTC
volang
(292)
I have received a string from a client that looks like this: "----Code".
When I search for "----Code", it doesn't result in a match. Only when I search for "Code" it works.
Any ideas ? :)
Last edited on
Dec 22, 2019 at 10:02pm UTC
Dec 22, 2019 at 10:20pm UTC
Repeater
(3046)
Examine the actual numerical values of the characters in the client string (and your search string) to confirm they're the same (or not).
1
2
3
4
for
(
const
auto
& elem : the_string) { std::cout <<
static_cast
<
unsigned
>(elem) <<
' '
; }
https://ideone.com/U0Kx8R
Dec 23, 2019 at 1:31am UTC
Ganado
(6811)
If the message is in unicode, there's tons of different dashes or hyphen or minus sign characters.
https://en.wikipedia.org/wiki/Dash#Common_dashes_and_Unicode_characters
Last edited on
Dec 23, 2019 at 1:36am UTC
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs