AnsiString s = "Hello, World!"; if (s.IsEmpty()) { // do something if the string is empty } else { // do something else if the string is not empty }
AnsiString s = ""; if (s.IsEmpty()) { // do something if the string is empty } else { // do something else if the string is not empty }In this example, we create an `AnsiString` object `s` and initialize it with an empty string. We then use the `IsEmpty` function to check whether `s` is empty or not. Since `s` is empty, the `if` block is executed. Package/library: `System` (C++ Builder)