Fixed spelling mistakes

This commit is contained in:
Skabunkel 2019-02-10 09:03:27 +01:00
parent 3e7b65ee2e
commit c78c05eac5
2 changed files with 15 additions and 12 deletions

View File

@ -1184,9 +1184,9 @@ RLAPI const char *TextToUpper(const char *text); // Get upp
RLAPI const char *TextToLower(const char *text); // Get lower case version of provided string
RLAPI const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
RLAPI int TextToInteger(const char *text); // Get integer value from text (negative values not supported)
RLAPI const char *TextTrim(const char *text, char trimChar); // Removes all chars equal to trimChar from the begining and end of the given text (memory should be freed!)
RLAPI const char *TextTrim(const char *text, char trimChar); // Removes all chars equal to trimChar from the beginning and end of the given text (memory should be freed!)
RLAPI const char *TextRightTrim(const char *text, char trimChar); // Removes all chars equal to trimChar from the end of the given text (memory should be freed!)
RLAPI const char *TextLeftTrim(const char *text, char trimChar); // Removes all chars equal to trimChar from the begining of the given text (memory should be freed!)
RLAPI const char *TextLeftTrim(const char *text, char trimChar); // Removes all chars equal to trimChar from the beginning of the given text (memory should be freed!)
//------------------------------------------------------------------------------------
// Basic 3d Shapes Drawing Functions (Module: models)

View File

@ -1089,17 +1089,18 @@ const char *TextSubtext(const char *text, int position, int length)
return buffer;
}
// removes a specific char from the begining of a string
// removes a specific char from the beginning of a string
// REQUIRES: strlen()
const char *TextLeftTrim(const char *text, char trimChar)
{
int textLength = strlen(text);
int leftOffset = 0;
for(leftOffset; leftOffset < textLength; leftOffset++)
{
if(*(text + leftOffset) != trimChar)
break;
if(*(text + leftOffset) != trimChar) break;
}
const char *subText = TextSubtext(text, leftOffset, textLength-leftOffset);
int subTextLength = strlen(subText);
char *result = malloc(subTextLength+1);
@ -1116,12 +1117,13 @@ const char *TextLeftTrim(const char *text, char trimChar)
const char *TextRightTrim(const char *text, char trimChar)
{
int textLength = strlen(text);
int rightOffset = textLength-1;
for(rightOffset; -1 < rightOffset; rightOffset--)
{
if(*(text + rightOffset) != trimChar)
break;
if(*(text + rightOffset) != trimChar) break;
}
const char *subText = TextSubtext(text, 0, rightOffset+1);
int subTextLength = strlen(subText);
char *result = malloc(subTextLength+1);
@ -1133,23 +1135,24 @@ const char *TextRightTrim(const char *text, char trimChar)
return result;
}
// removes a specific char from the begining of a string
// removes a specific char from the beginning and end of a string
// REQUIRES: strlen()
const char *TextTrim(const char *text, char trimChar)
{
int textLength = strlen(text);
int leftOffset = 0;
for(leftOffset; leftOffset < textLength; leftOffset++)
{
if(*(text + leftOffset) != trimChar)
break;
if(*(text + leftOffset) != trimChar) break;
}
int rightOffset = textLength-1;
for(rightOffset; leftOffset < rightOffset; rightOffset--)
{
if(*(text + rightOffset) != trimChar)
break;
if(*(text + rightOffset) != trimChar) break;
}
const char *subText = TextSubtext(text, leftOffset, rightOffset+1-leftOffset);
int subTextLength = strlen(subText);
char *result = malloc(subTextLength+1);