Fixed spelling mistakes
This commit is contained in:
parent
3e7b65ee2e
commit
c78c05eac5
|
|
@ -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 *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 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 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 *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)
|
// Basic 3d Shapes Drawing Functions (Module: models)
|
||||||
|
|
|
||||||
23
src/text.c
23
src/text.c
|
|
@ -1089,17 +1089,18 @@ const char *TextSubtext(const char *text, int position, int length)
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// removes a specific char from the begining of a string
|
// removes a specific char from the beginning of a string
|
||||||
// REQUIRES: strlen()
|
// REQUIRES: strlen()
|
||||||
const char *TextLeftTrim(const char *text, char trimChar)
|
const char *TextLeftTrim(const char *text, char trimChar)
|
||||||
{
|
{
|
||||||
int textLength = strlen(text);
|
int textLength = strlen(text);
|
||||||
|
|
||||||
int leftOffset = 0;
|
int leftOffset = 0;
|
||||||
for(leftOffset; leftOffset < textLength; leftOffset++)
|
for(leftOffset; leftOffset < textLength; leftOffset++)
|
||||||
{
|
{
|
||||||
if(*(text + leftOffset) != trimChar)
|
if(*(text + leftOffset) != trimChar) break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *subText = TextSubtext(text, leftOffset, textLength-leftOffset);
|
const char *subText = TextSubtext(text, leftOffset, textLength-leftOffset);
|
||||||
int subTextLength = strlen(subText);
|
int subTextLength = strlen(subText);
|
||||||
char *result = malloc(subTextLength+1);
|
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)
|
const char *TextRightTrim(const char *text, char trimChar)
|
||||||
{
|
{
|
||||||
int textLength = strlen(text);
|
int textLength = strlen(text);
|
||||||
|
|
||||||
int rightOffset = textLength-1;
|
int rightOffset = textLength-1;
|
||||||
for(rightOffset; -1 < rightOffset; rightOffset--)
|
for(rightOffset; -1 < rightOffset; rightOffset--)
|
||||||
{
|
{
|
||||||
if(*(text + rightOffset) != trimChar)
|
if(*(text + rightOffset) != trimChar) break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *subText = TextSubtext(text, 0, rightOffset+1);
|
const char *subText = TextSubtext(text, 0, rightOffset+1);
|
||||||
int subTextLength = strlen(subText);
|
int subTextLength = strlen(subText);
|
||||||
char *result = malloc(subTextLength+1);
|
char *result = malloc(subTextLength+1);
|
||||||
|
|
@ -1133,23 +1135,24 @@ const char *TextRightTrim(const char *text, char trimChar)
|
||||||
return result;
|
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()
|
// REQUIRES: strlen()
|
||||||
const char *TextTrim(const char *text, char trimChar)
|
const char *TextTrim(const char *text, char trimChar)
|
||||||
{
|
{
|
||||||
int textLength = strlen(text);
|
int textLength = strlen(text);
|
||||||
|
|
||||||
int leftOffset = 0;
|
int leftOffset = 0;
|
||||||
for(leftOffset; leftOffset < textLength; leftOffset++)
|
for(leftOffset; leftOffset < textLength; leftOffset++)
|
||||||
{
|
{
|
||||||
if(*(text + leftOffset) != trimChar)
|
if(*(text + leftOffset) != trimChar) break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int rightOffset = textLength-1;
|
int rightOffset = textLength-1;
|
||||||
for(rightOffset; leftOffset < rightOffset; rightOffset--)
|
for(rightOffset; leftOffset < rightOffset; rightOffset--)
|
||||||
{
|
{
|
||||||
if(*(text + rightOffset) != trimChar)
|
if(*(text + rightOffset) != trimChar) break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *subText = TextSubtext(text, leftOffset, rightOffset+1-leftOffset);
|
const char *subText = TextSubtext(text, leftOffset, rightOffset+1-leftOffset);
|
||||||
int subTextLength = strlen(subText);
|
int subTextLength = strlen(subText);
|
||||||
char *result = malloc(subTextLength+1);
|
char *result = malloc(subTextLength+1);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user