DEV Community

miccho27
miccho27

Posted on • Edited on • Originally published at rapidapi.com

Trim, Split & Reverse Text in 1 HTTP Call — Free String Utilities API (2026)

TL;DR: Get production-ready results in 1 HTTP call. No signup, no credit card, no rate limit.

👉 Try all 40+ Free APIs on RapidAPI

Free String Utilities API - Trim, Split, Reverse, Encode Text

String manipulation is tedious. Trimming whitespace, splitting by delimiters, case conversion, URL encoding—every language has slightly different APIs. What if you could manipulate strings via REST API without worrying about language-specific quirks?

The String Utilities API performs common text operations instantly: trim/strip, case conversion (upper/lower/title), split/join, reverse, truncate, pad, URL/HTML encoding/decoding, character count, word count. Perfect for data cleaning, text preprocessing, API payload transformation, and content normalization.

Why Use This API?

String operations matter:

  • Data Cleaning – Normalize user input, remove whitespace
  • Text Processing – Split, join, reverse text efficiently
  • Encoding – Convert between text, HTML, URL, Base64
  • Content Formatting – Truncate, pad, wrap text
  • Cross-language – Consistent string handling across languages

Quick Example - cURL

# Perform multiple string operations
curl -X POST "https://string-utilities-api.p.rapidapi.com/manipulate" \
  -H "X-RapidAPI-Key: YOUR_KEY" \
  -H "X-RapidAPI-Host: string-utilities-api.p.rapidapi.com" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "  Hello World  ",
    "operations": ["trim", "lowercase", "reverse"]
  }'
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "success": true,
  "original": "  Hello World  ",
  "results": {
    "trim": "Hello World",
    "lowercase": "  hello world  ",
    "reverse": "  dlroW olleH  "
  }
}
Enter fullscreen mode Exit fullscreen mode

Python Example

import requests

url = "https://string-utilities-api.p.rapidapi.com/manipulate"
headers = {
    "X-RapidAPI-Key": "YOUR_API_KEY",
    "X-RapidAPI-Host": "string-utilities-api.p.rapidapi.com",
    "Content-Type": "application/json"
}

# Clean user input
user_input = "  JoHn DoE  "

payload = {
    "text": user_input,
    "operations": ["trim", "title_case"]
}

response = requests.post(url, json=payload, headers=headers)
data = response.json()

cleaned = data["results"]["title_case"]  # "John Doe"
print(f"Normalized: {cleaned}")
Enter fullscreen mode Exit fullscreen mode

JavaScript / Node.js Example

const axios = require("axios");

const stringUtils = async (text, operations) => {
  const response = await axios.post(
    "https://string-utilities-api.p.rapidapi.com/manipulate",
    { text, operations },
    {
      headers: {
        "X-RapidAPI-Key": process.env.RAPIDAPI_KEY,
        "X-RapidAPI-Host": "string-utilities-api.p.rapidapi.com"
      }
    }
  );

  return response.data.results;
};

// Process form input
const formData = {
  name: "  jOhN dOe  ",
  email: " USER@EXAMPLE.COM ",
  bio: "I love coding!                    "  // Extra spaces
};

const cleaned = {
  name: (await stringUtils(formData.name, ["trim", "title_case"])).title_case,
  email: (await stringUtils(formData.email, ["trim", "lowercase"])).lowercase,
  bio: (await stringUtils(formData.bio, ["trim"])).trim
};

console.log("Cleaned form:", cleaned);
Enter fullscreen mode Exit fullscreen mode

Supported Operations

Operation Input Output Use Case
trim " hello " "hello" Remove whitespace
uppercase "hello" "HELLO" URL slugs, API keys
lowercase "HELLO" "hello" Normalization
title_case "hello world" "Hello World" Proper names
reverse "hello" "olleh" Palindrome checks
split "a,b,c" ["a", "b", "c"] Parsing delimited data
truncate "hello world" (max 5) "hello" Limit length
pad "5" (width 3) " 5" Formatting numbers
urlencode "hello world" "hello%20world" URL encoding
htmlencode "" "<div>" HTML escaping
base64_encode "hello" "aGVsbG8=" Data encoding
word_count "hello world" 2 Analytics
char_count "hello" 5 Length checking

Real-World Use Cases

1. Form Input Validation & Cleaning

Normalize user input before storage.

def clean_user_data(user_input):
    operations = ["trim", "lowercase"]
    if user_input.startswith("@"):
        operations.append("remove_special")

    result = string_utils(user_input, operations)
    return result
Enter fullscreen mode Exit fullscreen mode

2. Data Import & CSV Processing

Clean and normalize data from imported files.

def import_csv(csv_data):
    cleaned_records = []

    for row in csv_data:
        cleaned_row = {}
        for key, value in row.items():
            # Trim and lowercase all fields
            cleaned_row[key] = string_utils(value, ["trim", "lowercase"])
        cleaned_records.append(cleaned_row)

    return cleaned_records
Enter fullscreen mode Exit fullscreen mode

3. URL & Email Processing

Normalize and encode URLs/emails.

def process_email(email_input):
    # Trim, lowercase, URL encode for safe storage
    result = string_utils(email_input, [
        "trim",
        "lowercase",
        "urlencode"
    ])
    return result
Enter fullscreen mode Exit fullscreen mode

4. Content Truncation for Previews

Create truncated previews of long content.

def create_preview(content, max_length=100):
    preview = string_utils(
        content,
        ["truncate"],  # max_length parameter
        options={"truncate_length": max_length}
    )
    return preview + "..."
Enter fullscreen mode Exit fullscreen mode

5. Multi-language Text Processing

Handle text across different cases and encodings.

def normalize_for_search(query):
    # Remove accents, lowercase, trim
    normalized = string_utils(query, [
        "remove_accents",
        "lowercase",
        "trim"
    ])
    return normalized
Enter fullscreen mode Exit fullscreen mode

6. Security: HTML Escaping

Prevent XSS by encoding user input for HTML.

def safe_display_user_comment(comment):
    # Escape HTML to prevent script injection
    safe_comment = string_utils(comment, ["htmlencode"])
    return f"<div class='comment'>{safe_comment}</div>"
Enter fullscreen mode Exit fullscreen mode

7. Analytics: Word/Char Count

Calculate reading metrics.

def get_article_metrics(article_text):
    metrics = string_utils(article_text, ["word_count", "char_count"])

    return {
        "words": metrics["word_count"],
        "characters": metrics["char_count"],
        "estimated_read_time": metrics["word_count"] / 200  # 200 wpm
    }
Enter fullscreen mode Exit fullscreen mode

Pricing

Plan Cost Requests/Month Best For
Free $0 500 Testing, small projects
Pro $5.99 50,000 Production apps
Ultra $14.99 500,000 Data processing, bulk ops

Related APIs

  • Regex Tester API – Pattern matching and replacement
  • Text Analysis API – Analyze text properties
  • Email Validation API – Validate processed emails
  • Markdown to HTML API – Process markdown strings

Get Started Now

Manipulate strings free on RapidAPI

No credit card. 500 free requests for string operations.


Processing user input at scale? Share your cleaning strategy in the comments!

Top comments (0)