StringUtils.pkg 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. $#include "StringUtils.h"
  2. /// Parse a bool from a string. Check for the first non-empty character (converted to lowercase) being either 't', 'y' or '1'.
  3. bool ToBool(const String& source);
  4. /// Parse a bool from a C string. Check for the first non-empty character (converted to lowercase) being either 't', 'y' or '1'.
  5. bool ToBool(const char* source);
  6. /// Parse a float from a string.
  7. float ToFloat(const String& source);
  8. /// Parse a float from a C string.
  9. float ToFloat(const char* source);
  10. /// Parse an integer from a string.
  11. int ToInt(const String& source);
  12. /// Parse an integer from a C string.
  13. int ToInt(const char* source);
  14. /// Parse an unsigned integer from a string.
  15. unsigned ToUInt(const String& source);
  16. /// Parse an unsigned integer from a C string.
  17. unsigned ToUInt(const char* source);
  18. /// Parse a Color from a string.
  19. Color ToColor(const String& source);
  20. /// Parse a Color from a C string.
  21. Color ToColor(const char* source);
  22. /// Parse an IntRect from a string.
  23. IntRect ToIntRect(const String& source);
  24. /// Parse an IntRect from a C string.
  25. IntRect ToIntRect(const char* source);
  26. /// Parse an IntVector2 from a string.
  27. IntVector2 ToIntVector2(const String& source);
  28. /// Parse an IntVector2 from a C string.
  29. IntVector2 ToIntVector2(const char* source);
  30. /// Parse a Quaternion from a string. If only 3 components specified, convert Euler angles (degrees) to quaternion.
  31. Quaternion ToQuaternion(const String& source);
  32. /// Parse a Quaternion from a C string. If only 3 components specified, convert Euler angles (degrees) to quaternion.
  33. Quaternion ToQuaternion(const char* source);
  34. /// Parse a Rect from a string.
  35. Rect ToRect(const String& source);
  36. /// Parse a Rect from a C string.
  37. Rect ToRect(const char* source);
  38. /// Parse a Vector2 from a string.
  39. Vector2 ToVector2(const String& source);
  40. /// Parse a Vector2 from a C string.
  41. Vector2 ToVector2(const char* source);
  42. /// Parse a Vector3 from a string.
  43. Vector3 ToVector3(const String& source);
  44. /// Parse a Vector3 from a C string.
  45. Vector3 ToVector3(const char* source);
  46. /// Parse a Vector4 from a string.
  47. Vector4 ToVector4(const String& source, bool allowMissingCoords = false);
  48. /// Parse a Vector4 from a C string.
  49. Vector4 ToVector4(const char* source, bool allowMissingCoords = false);
  50. /// Convert a pointer to string (returns hexadecimal.)
  51. String ToString(void* value);
  52. /// Convert an unsigned integer to string as hexadecimal.
  53. String ToStringHex(unsigned value);
  54. /// Return whether a char is an alphabet letter.
  55. bool IsAlpha(unsigned ch);
  56. /// Return whether a char is a digit.
  57. bool IsDigit(unsigned ch);