Depth-Studios
Welcome guest (Login / Register)
string partial compare

Definition


bool partial_compare_string(char *string, char *comparison, size_t offset, bool case_sensitive);


Description


Compare both string arguments


Parameters


string
First string to compare.
comparison
String to compare with.
offset
Start point of where to start the compare with compare_string.
case_sensitive
If false, the comparison will not look at the current case.


Return Value


Returns true when both strings are equal or partial equal, otherwise this function will return false.


Example


#include <stdio.h>
#include <libc/string.h>
 
int main(int argc, char *argv[])
{
	if(partial_compare_string("Hello World", "world", 6, true))
	{
		printf("Both strings are equal\n");
	}
	else
	{
		printf("Both strings are not equal\n");
	}
 
 
	if(partial_compare_string("Hello World", "World", 6, false))
	{
		printf("Both strings are equal\n");
	}
	else
	{
		printf("Both strings are not equal\n");
	}
 
	return 0;
}


Output:
Both strings are not equal
Both strings are equal