String Utilities

Ends With

Validates whether a string ends with a specific suffix pattern. Use via MCP in Cursor or Windsurf for text validation tasks, or call GET /v1/string/ends-with directly. Returns true/false for cases like checking file extensions (".jpg") or URL patterns ("/api"). Case-sensitive by default with optional ignore-case parameter.

API Endpoint

GET /v1/string/ends-with

Code Examples

curl "https://tinyfn.io/v1/string/ends-with" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/string/ends-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/ends-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 filename ends with .pdf using the ends-with tool?

Pass the filename as the text parameter and ".pdf" as the suffix. The tool returns true if the filename ends exactly with those characters, false otherwise.

Is the ends-with check case sensitive?

Yes, by default it's case-sensitive. "File.PDF" won't match suffix ".pdf". Most implementations include a case-insensitive option via query parameter.

Can I use ends-with in MCP tools like Cursor for batch file validation?

Yes, MCP integration lets AI agents validate multiple files at once. Useful for filtering file lists or validating user uploads in development workflows.

What's the difference between ends-with and contains for string matching?

Ends-with only matches the exact end of a string, while contains finds the pattern anywhere. Use ends-with for suffixes like extensions, contains for general text search.

Does ends-with work with empty strings or special characters?

Empty suffix returns true for any string. Special characters like spaces, dots, and Unicode work normally—just ensure proper URL encoding for REST API calls.

Try Ends With Now

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

Get Free API Key