diff --git a/String Manipulation/StringTerminateStringAtChar.cpp b/String Manipulation/StringTerminateStringAtChar.cpp new file mode 100644 index 0000000..4d1b697 --- /dev/null +++ b/String Manipulation/StringTerminateStringAtChar.cpp @@ -0,0 +1,31 @@ +PCHAR StringTerminateStringAtCharA(PCHAR String, INT Character) +{ + DWORD Length = (DWORD)StringLengthA(String); + + for (DWORD Index = 0; Index < Length; Index++) + { + if (String[Index] == Character) + { + String[Index] = '\0'; + return String; + } + } + + return NULL; +} + +PWCHAR StringTerminateStringAtCharW(PWCHAR String, INT Character) +{ + DWORD Length = (DWORD)StringLengthW(String); + + for (DWORD Index = 0; Index < Length; Index++) + { + if (String[Index] == Character) + { + String[Index] = '\0'; + return String; + } + } + + return NULL; +}