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

Both sides previous revisionPrevious revision
Next revision
Previous revision
string [2019/04/19 02:40] korshunstring [2019/04/19 02:48] (current) – [Checking string equality] 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> <note warning>Do not use ''=='' to check if strings are equal.</note>
Line 17: Line 17:
 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. 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 to check if strings are equal:+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)'' ''bool StrEquals(str a, str b)''
  
-And also a case-insensitive version:+Internally, this function calls harder to use [[zdoom>StrCmp]], but it 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)'' ''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.1555630831.txt.gz · Last modified: 2019/04/19 02:40 by korshun