String Utilities

Starts With

Quick text prefix validation via GET /v1/string/starts-with or MCP in Cursor and other AI editors. Returns boolean true/false for whether a string begins with the specified prefix. Case-sensitive by default, with optional case-insensitive matching. Essential for URL routing, file type detection, and parsing workflows where AI agents need deterministic string matching.

API Endpoint

GET /v1/string/starts-with

Code Examples

curl "https://tinyfn.io/v1/string/starts-with" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/string/starts-with', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/string/starts-with',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's string tools:

{
  "mcpServers": {
    "tinyfn-string": {
      "url": "https://tinyfn.io/mcp/string",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I check if a string starts with a prefix using the starts-with API?

Send a GET request to /v1/string/starts-with with 'text' and 'prefix' parameters. Returns {"result": true} if the string starts with the prefix, {"result": false} otherwise.

Is the starts-with function case-sensitive?

Yes, by default it's case-sensitive. 'Hello' starts with 'H' but not 'h'. Most implementations offer a case-insensitive option via an additional parameter.

Can MCP tools in Cursor use starts-with for file path validation?

Absolutely. AI agents can check if file paths start with specific directories, validate URL schemes, or filter lists based on prefixes without hallucinating the matching logic.

What happens if I check an empty string or empty prefix?

An empty string doesn't start with any non-empty prefix (returns false). Every string starts with an empty prefix (returns true). Edge case handling is deterministic.

How does starts-with differ from contains or regex matching?

Starts-with only checks the beginning of the string, making it faster than full string searches. More predictable than regex for simple prefix validation in AI workflows.

Try Starts With Now

Get your free API key and start using Starts With in seconds.

Get Free API Key