Skip to content

Commit fb2cf1c

Browse files
committed
Key-Value Pair and Delimiters in Strings
Signed-off-by: https://github.com/Someshdiwan <someshdiwan369@gmail.com>
1 parent f194e36 commit fb2cf1c

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Key-Value Pair and Delimiters in Strings
2+
3+
## 1. Format of Key-Value Pairs
4+
- Each key-value pair follows the format:
5+
**key=value**
6+
- Multiple pairs are separated by a delimiter `;`.
7+
8+
**Example:**
9+
- `"name=Vijay"` → key = `name`, value = `Vijay`
10+
- `"address=delhi"` → key = `address`, value = `delhi`
11+
- `"country=india"` → key = `country`, value = `india`
12+
- `"dept=cse"` → key = `dept`, value = `cse`
13+
14+
---
15+
16+
## 2. Delimiters
17+
- `=` → separates **key** and **value**.
18+
- `;` → separates **different key-value pairs**.
19+
20+
Thus, a string like:
21+
22+
“name=Vijay;address=delhi;country=india;dept=cse”
23+
24+
represents **four tokens**.
25+
26+
---
27+
28+
## 3. Purpose of Using Delimiters
29+
- When a string contains structured data separated by delimiters,
30+
we can extract and process each piece of data using **string tokenization**.
31+
32+
**Concept:**
33+
- Each meaningful unit (e.g., `"name"`, `"Vijay"`) is called a **token**.
34+
- Example:
35+
`"name=Vijay"` → produces tokens: `name` and `Vijay`.
36+
37+
---
38+
39+
## 4. Key Takeaway
40+
- **Delimiters**: characters like `=` and `;` used to split structured strings.
41+
- **Tokens**: individual parts obtained after splitting.
42+
- **Application**: parsing configuration strings, query parameters, CSV data, etc.
43+
44+

0 commit comments

Comments
 (0)