Commit aebd2d4
committed
feat: Demonstrate use of
🧪 Functionality:
1. Replace all occurrences of the character `'u'` with `'M'` in the original string.
➤ Input: "Abdul Bari Don"
➤ Output: "AbdMl Bari Don"
2. Extract a substring from index 3 (inclusive) to 5 (exclusive), and trim any whitespace.
➤ Substring: "ul" → After `trim()`: "ul"
🧰 Methods Used:
- `String.replace(char oldChar, char newChar)` — Replaces each occurrence of the specified character.
- `String.substring(int beginIndex, int endIndex)` — Extracts part of the string.
- `String.trim()` — Removes leading and trailing whitespace.
✅ Purpose:
Simple demonstration of basic `String` operations: replacement and substring extraction with trimming.
Signed-off-by: Somesh diwan <[email protected]>replace and substring with trim on a String1 parent a637f88 commit aebd2d4
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
0 commit comments