Usage

All string methods are called directly on string values using JavaScript-style method syntax. They behave exactly like standard JavaScript string methods.

Basic String Method Usage

Available Methods

split()

Transformation

Splits a string into an array of substrings using a separator

Usage: str.split(separator)

concat()

Transformation

Concatenates multiple strings together into a single string

Usage: str.concat(...strings)

substring()

Transformation

Extracts a portion of the string between two indices

Usage: str.substring(start, end?)

toUpperCase()

Transformation

Converts all characters in the string to uppercase

Usage: str.toUpperCase()

toLowerCase()

Transformation

Converts all characters in the string to lowercase

Usage: str.toLowerCase()

trim()

Transformation

Removes whitespace from both ends of the string

Usage: str.trim()

replace()

Transformation

Replaces the first occurrence of a search string with a replacement string

Usage: str.replace(search, replaceWith)

indexOf()

Inspection

Returns the index of the first occurrence of a substring (-1 if not found)

Usage: str.indexOf(searchValue)

startsWith()

Inspection

Checks if the string starts with the specified prefix

Usage: str.startsWith(prefix)

endsWith()

Inspection

Checks if the string ends with the specified suffix

Usage: str.endsWith(suffix)

length()

Inspection

Returns the number of characters in the string

Usage: str.length()
📖
Introduction
Overview of kScript language
🔍
Overview
Complete technical documentation
🚀
Quick Start
Get started with kScript basics
📋
Function Reference
Complete API reference guide
📚
Type System
Understanding kScript data types
General FAQ
Frequently asked questions about kScript
Best Practices
Guidelines for writing efficient kScript code
⚠️
Limitations
Known constraints and workarounds
🌐
Exchange & Symbol Format
List of supported exchanges and symbol formats
🆕
Updates
v1 vs v2 differences and improvements
🔧
Variables
Core variables and data handling
📊
Data Sources
Subscribe to OHLCV, trades, and orderbook data
⚙️
Execution Model
Per-bar execution lifecycle and phases
🏷️
Keyword Arguments
Named parameters for clear function calls
🛠️
User-Defined Functions
Create custom reusable functions
🔗
Script Definition
Defining inputs and metadata
🎯
Utility Functions
Helper functions and calculations
📈
Moving Averages
SMA, EMA and trend-following indicators
📊
Oscillators
RSI, Stochastic and momentum indicators
📈
Trend Indicators
Trend direction and strength analysis
📉
Volume Indicators
Volume-based analysis tools
📦
Orderbook Functions
Market depth analysis tools
🎨
Plotting & Visualization
Chart rendering and styling
🌈
Color Functions
Color manipulation and styling
🔄
Loops
For loops and while loops for iteration
🧮
Math Functions
Mathematical functions and constants
📝
String Functions
String manipulation and transformation
🏠
Go Home
Return to main landing page