String Object
The String object is used to represent and manipulate text in Bnlang.
It supports creation with the String
constructor and provides many methods for searching, modifying, and formatting text.
Create String
const s1 = new অক্ষরমালা("হ্যালো");
ছাপাও(s1.বড়_অক্ষরে_রূপান্তর()); // "হ্যালো" বড় হরফে
Common Methods
charAt(index)
→ Character at indexindexOf(substr)
→ Find positionslice(start, end)
→ Extract substringtoUpperCase()
/toLowerCase()
→ Case conversiontrim()
→ Remove spacesreplace(find, value)
→ Replace contentsplit(sep)
→ Split string into array
Examples
const নাম = "বিএনল্যাং";
ছাপাও(নাম.অন্তর্ভুক্ত_আছে("ল্যাং")); // true
ছাপাও(নাম.ছোট_অক্ষরে_রূপান্তর()); // "bnlang"
Best Practices
- Prefer using
String
methods instead of manual loops. - Use
trim()
before comparisons to avoid whitespace issues. - Use
includes()
overindexOf()
for readability.