ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


string

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
string [2019/04/19 02:18] – created korshunstring [2019/04/19 02:46] korshun
Line 11: Line 11:
 ''%%""%%'' is an empty string, i.e. a valid string of length 0. It can be passed to any function and will work as expected. ''%%""%%'' is an empty string, i.e. a valid string of length 0. It can be passed to any function and will work as expected.
  
-===== Comparing strings for equality =====+===== Checking string equality =====
  
 +<note warning>Do not use ''=='' to check if strings are equal.</note>
  
 +Operator ''=='' only checks if string **numbers** are equal. It may mostly work and then stop working randomly, or when used with a string coming from a different ACS library.
  
 +To check if strings are equal, you need to compare their contents. ACSUtils provides an easy to use function for this, which returns true if two strings are equal:
 +
 +''bool StrEquals(str a, str b)''
 +
 +Internally, this function calls harder to use [[zdoom>StrCmp]], but they could just as well be implemented using a combination of [[zdoom>StrLen]] and [[zdoom>GetChar]].
 +
 +There is also a case-insensitive version:
 +
 +''bool StrIEquals(str a, str b)''
 +
 +It's implemented using [[zdoom>StrICmp]].
 +
 +===== String functions =====
 +
 +==== StrIsEmpty ====
 +''bool StrIsEmpty(str s)''
 +
 +Returns true if the string is an empty string (''%%""%%'').
  
  
  
  
string.txt · Last modified: 2019/04/19 02:48 by korshun