C++C++11C++14C++17Learn C++

Learn About Delimiters (Tokens) in Modern C++ On Windows

Delimiters (token term also used) are characters which separates strings between each of them. For example spaces, comas and other symbols can be used as a delimiter char to separate strings between them . Normaly in C++ strtok() were being used in C++, that is used with chars. In Modern C++, strings are now UnicodeStrings, TStringlists has some property to extract strings. If you are new to UnicodeStrings please check here

Example procedure below shows how to split a UnicodeString to a StringList which has delimited UnicodeStrings

We can easily use this In C++ Builder. Create a new “Multi-Device C++ Builder Project” , Add a Memo and a Button on the Form of Project. Double click to Button, add this split procedure and OnClick() event of Button as below;

Header of this project will be automatically like this.

We can use any UnicodeString Chars as given above in L’ ‘ format. This method supports UnicodeStrings, because of this it is much more modern than classic strtok() function. Instead of this split(…) definition, we can also define this function as a member of Form like this;

This time this split procedure should be defined as a a public member in public: definitions of Form1 class as below;

Using Delimiters globally in all languages requires to use of UnicodeStrings, and sometimes analyzing these text forms highly needs this kind of new modern methods. We think that this example will help you to analyze Unicode text forms.

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.

About author

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
C++C++11C++14C++17C++20Introduction to C++Learn C++

Learn Copy Constructors in C++ Classes

C++C++11C++14C++17Introduction to C++Learn C++Syntax

Learn How To Use Types Of Destructors In C++?

C++C++11C++14Learn C++Syntax

How To Convert u32string To A wstring In C++

C++C++11C++14C++17C++20Introduction to C++Learn C++

How To Learn The Move Constructors In Modern C++?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Worth reading...
Unicode Strings in C++ On Windows