Низ: Разлика между версии

Изтрито е съдържание Добавено е съдържание
м Bot: Automated text replacement (-( +()
м Bot: Automated text replacement (- ) +))
Ред 341:
boolean returnValue;
 
returnValue = example.endsWith(" Wikipedia!" );
System.out.println(returnValue);
 
returnValue = example.endsWith("Wiki" );
System.out.println(returnValue);
//true
Ред 364:
String anotherExample = "hello, world";
Object objectExample = example;
System.out.println(example.compareTo(anotherExample) );
System.out.println(example.compareTo(objectExample) );
//-32
//0
Ред 373:
String example = "Hello, World";
String anotherExample = "hello, world";
System.out.println(example.compareToIgnoreCase(anotherExample) );
//0
</source>
Ред 453:
char* str1 = strdup("Hello"); //Друг начин за инициализиране.
char* str2 = malloc(strlen (str1) + 8); // Заделяме памет с malloc, колкото дължината на предишния низ + допълнително.
strcpy(str2, str1 ); // Копиране на str1 в str2.
strcat(str2, " world!"); // Конкатениране на получения низ с " world!".
free(str1); // Освобождаване на първия низ.