# cwchar

***

**1. String Comparison**

```cpp
bool result = wcscmp(str1, str2) == 0;  // Compare two wide character strings
```

**2. String Concatenation**

```cpp
wchar_t wstr[100];
wcscat(wstr, L"Hello");
wcscat(wstr, L" World");  // Concatenate two wide character strings
```

**3. String Copying**

```cpp
wchar_t wstr[100];
wcscpy(wstr, L"Hello World");  // Copy a wide character string
```

**4. String Length**

```cpp
size_t length = wcslen(wstr);  // Get the length of a wide character string
```

**5. Character Conversion (Wide to Multibyte)**

```cpp
char *mbstr = new char[length * 2 + 1];
wcstombs(mbstr, wstr, length);  // Convert a wide character string to a multibyte string
```

**6. Character Conversion (Multibyte to Wide)**

```cpp
wchar_t *wstr = new wchar_t[length + 1];
mbstowcs(wstr, mbstr, length);  // Convert a multibyte string to a wide character string
```

**7. String Search**

```cpp
wchar_t *result = wcsstr(wstr, L"World");  // Find the first occurrence of a substring in a wide character string
```

**8. String Substitution**

```cpp
wchar_t *result = wcsreplace(wstr, L"World", L"Universe");  // Replace all occurrences of a substring with another substring
```

**9. String Tokenization**

```cpp
wchar_t *token = wcstok(wstr, L" ");  // Tokenize a wide character string using a delimiter
```

**10. String Formatting**

```cpp
wchar_t buffer[100];
swprintf(buffer, 100, L"Value: %d", value);  // Format a wide character string with a specified format string
```

**11. Character Classification**

```cpp
bool isLower = iswlower(wchr);  // Check if a wide character is lowercase
```

**12. Character Case Conversion**

```cpp
wchr = towupper(wchr);  // Convert a wide character to uppercase
```

**13. String Trim**

```cpp
wchar_t *trimmedStr = wcsltrim(wstr);  // Trim leading whitespace from a wide character string
```

**14. String Split**

```cpp
vector<wchar_t*> tokens = wcssplit(wstr, L" ");  // Split a wide character string into tokens based on a delimiter
```

**15. Wide Character to Integer**

```cpp
int value = wcstol(wstr, NULL, 10);  // Convert a wide character string to an integer
```

**16. Integer to Wide Character**

```cpp
wchar_t *wstr = wcstoul(L"123", NULL, 10);  // Convert an integer to a wide character string
```

**17. Wide Character to Floating-Point**

```cpp
double value = wcstod(wstr, NULL);  // Convert a wide character string to a floating-point number
```

**18. Floating-Point to Wide Character**

```cpp
wchar_t *wstr = wcstof(123.45, NULL);  // Convert a floating-point number to a wide character string
```

**19. String Length (Without Null-Terminator)**

```cpp
size_t length = wcsnlen(wstr, 10);  // Get the length of a wide character string without counting the null-terminator
```

**20. String Memory Set**

```cpp
wmemset(wstr, L'a', 10);  // Set a specified number of wide characters in a wide character string to a given value
```

**21. String Memory Copy**

```cpp
wmemcpy(wstr1, wstr2, 10);  // Copy a specified number of wide characters from one wide character string to another
```

**22. String Memory Move**

```cpp
wmemmove(wstr1, wstr2, 10);  // Move a specified number of wide characters from one wide character string to another, overlapping if necessary
```

**23. String Memory Compare**

```cpp
int result = wmemcmp(wstr1, wstr2, 10);  // Compare a specified number of wide characters in two wide character strings
```

**24. String Find First Of**

```cpp
wchar_t *result = wcschr(wstr, L'a');  // Find the first occurrence of a wide character in a wide character string
```

**25. String Find Last Of**

```cpp
wchar_t *result = wcsrchr(wstr, L'a');  // Find the last occurrence of a wide character in a wide character string
```

**26. String Preamble**

```cpp
wchar_t *result = wcsdup(wstr);  // Create a new wide character string that is a duplicate of an existing one
```

**27. Wide Character to Wide String**

```cpp
wchar_t *wstr = wctomb(wchr);  // Convert a wide character to a wide character string
```

**28. Wide String to Wide Character**

```cpp
wchar_t wchr = btowc(wstr);  // Convert a wide character string to a wide character
```

**29. Wide Character to Multibyte**

```cpp
char mbchr = wctomb(wchr);  // Convert a wide character to a multibyte character
```

**30. Multibyte to Wide Character**

```cpp
wchar_t wchr = btowc(mbchr);  // Convert a multibyte character to a wide character
```

**31. Wide Character to Narrow**

```cpp
char nchr = wctomb(wchr);  // Convert a wide character to a narrow character
```

**32. Narrow to Wide Character**

```cpp
wchar_t wchr = btowc(nchr);  // Convert a narrow character to a wide character
```

**33. Wide Character Stream I/O**

```cpp
fputwc(wchr, fp);  // Write a wide character to a wide character stream
```

**34. Wide Character Stream I/O**

```cpp
wchr = fgetwc(fp);  // Read a wide character from a wide character stream
```

**35. Wide Character Stream Buffer**

```cpp
mbstate_t state = {0};
wimbue(fin, &state);  // Set the wide character stream buffer
```

**36. Wide Character Stream Buffer**

```cpp
mbstate_t state = {0};
wunimbue(fin, &state);  // Remove the wide character stream buffer
```

**37. Wide Character Stream Format Functions**

```cpp
wprintf(L"Hello World");  // Print a formatted wide character string to standard output
```

**38. Wide Character Stream Format Functions**

```cpp
wscanf(L"%d", &value);  // Read a formatted wide character string from standard input
```

**39. Wide Character Stream I/O (File)**

```cpp
fwprintf(fp, L"Hello World");  // Print a formatted wide character string to a file
```

**40. Wide Character Stream I/O (File)**

```cpp
fwscanf(fp, L"%d", &value);  // Read a formatted wide character string from a file
```

**41. Wide Character String Operations**

```cpp
wchar_t *wstr = towlower(L"Hello World");  // Convert a wide character string to lowercase
```

**42. Wide Character String Operations**

```cpp
wchar_t *wstr = towupper(L"Hello World");  // Convert a wide character string to uppercase
```

**43. Wide Character String Operations**

```cpp
int result = wcsicmp(L"Hello World", L"HELLO WORLD");  // Compare two wide character strings case-insensitively
```

**44. Wide Character String Operations**

```cpp
wchar_t *wstr = wcscpy(wstr1, L"Hello World");  // Copy a wide character string to another
```

**45. Wide Character String Operations**

```cpp
wchar_t *wstr = wcscat(wstr1, L"Hello World");  // Concatenate two wide character strings
```

**46. Wide Character String Operations**

```cpp
size_t length = wcslen(wstr);  // Get the length of a wide character string
```

**47. Wide Character String Operations**

```cpp
wchar_t *wstr = wcsubstr(wstr1, 5, 10);  // Extract a substring from a wide character string
```

**48. Wide Character String Operations**

```cpp
wchar_t *wstr = wcstok(wstr, L" ");  // Tokenize a wide character string based on a delimiter
```

**49. Wide Character String Operations**

```cpp
bool result = wcschr(wstr, L'a');  // Check if a wide character is present in a wide character string
```

**50. Wide Character String Operations**

```cpp
bool result = wcsrchr(wstr, L'a');  // Check if a wide character is present in a wide character string from the end

```
