String Comparison Operator
bauss via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Apr 30 12:05:18 PDT 2017
On Sunday, 30 April 2017 at 16:15:41 UTC, Xinok wrote:
> On Sunday, 30 April 2017 at 15:31:39 UTC, Jolly James wrote:
>> Is there a String Comparison Operator in D?
>
> Yeah, just the usual comparison operators:
>
> "abc" == "abc"
> "abc" != "ABC"
>
>
> ~ is for string concatenation, i.e.:
>
> "abc" ~ "def" == "abcdef"
Just to clarify.
It's not actually a string concatenation operator, it's an array
appending operator.
Strings are just an alias for immutable(char)[] and not actually
a type unlike other languages like C#, Java etc. where strings
are objects.
In fact it doesn't have any operators that doesn't work with any
other type of arrays. Just like functions such as replace etc.
aren't necessarily string functions, but works with any type of
arrays.
More information about the Digitalmars-d-learn
mailing list