Strings
API
Substring
You can use the substring method to check if a string contains another string.
import { expect } from "@rbxts/expect";
expect("my name").to.have.the.substring("my");
Example error
Expected "your name" to have the substring "my"
Pattern
You can use the pattern method to check if a string contains a match for a roblox string pattern.
import { expect } from "@rbxts/expect";
expect("Hello World").to.have.the.pattern("%u%l");
Example error
Expected "hello world" to have a match for the pattern /%u%l/, but it was missing
Empty
You can use the empty method to check if a string has any characters.
import { expect } from "@rbxts/expect";
expect("").to.be.empty();
Example error
Expected "daymon" to be empty, but it was not
Size
You can use the size method to check if a string has a certain amount of characters.
import { expect } from "@rbxts/expect";
expect("daymon").to.have.a.sizeOf(6);
Example error
Expected "12345" to have a size of exactly '6', but it actually had a size of '5'
Starts with
You can use the startsWith method to check if a string starts with another string.
import { expect } from "@rbxts/expect";
expect("daymon").to.startWith("day");
Example error
Expected "day" to be a string that starts with "bry", but it was missing
Ends with
You can use the endsWith method to check if a string ends with another string.
import { expect } from "@rbxts/expect";
expect("daymon").to.endWith("mon");
Example error
Expected "daymon" to be a string that ends with "yan", but it was missing
All of
info