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 index
  • indexOf(substr) → Find position
  • slice(start, end) → Extract substring
  • toUpperCase() / toLowerCase() → Case conversion
  • trim() → Remove spaces
  • replace(find, value) → Replace content
  • split(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() over indexOf() for readability.