{"uid":"cap_UZFplH3J-uUYDIHH5iYVg","slug":"fittings-text-character-edit-fd467a0d","name":"fittings Text Character Edit","description":"Insert, delete, replace, extract, locate or measure at exact character offsets, counting by grapheme, code point or UTF-16 unit, with the affected range reported in both the chosen unit and UTF-16.","url":"https://fittings.sh/v1/text/char-edit","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"op":{"type":"string","description":"insert | delete | replace | extract | find | measure"},"end":{"type":"number","description":"delete, replace, extract: offset just past the range"},"find":{"type":"string","description":"find: substring to locate"},"from":{"type":"number","description":"find: offset to start searching at, default 0"},"text":{"type":"string","description":"Text to operate on, 20000 UTF-16 units or fewer"},"unit":{"type":"string","description":"grapheme | codepoint (default) | utf16"},"index":{"type":"number","description":"insert: offset to insert before"},"start":{"type":"number","description":"delete, replace, extract: first offset in the range"},"value":{"type":"string","description":"insert, replace: text to put in, 5000 UTF-16 units or fewer"}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.0036","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.0036/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0036","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0036","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_Da8YVeCZyomro5A3upzqw","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.0036","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Performs precise character-level operations (insert, delete, replace, extract, find, measure) on text strings using grapheme, code point, or UTF-16 unit counting, returning affected ranges in both chosen unit and UTF-16.","exampleAgentPrompt":"In the string 'Hello 🌍 world', delete the characters from offset 6 to 8 counting by grapheme, and tell me the resulting text and the affected range in both grapheme units and UTF-16 units.","exampleUseCases":[{"title":"Safe emoji string truncation","prompt":"I have the string '🎉🎊🎈Party time🎈🎊🎉' and I need to extract just the first 3 grapheme clusters — can you extract from offset 0 to 3 counting by grapheme so I don't accidentally split any emoji?"},{"title":"Multilingual text insertion","prompt":"Take the Arabic string 'مرحبا عالم' and insert the word ' جميل' at grapheme offset 5, counting by grapheme cluster — what does the result look like?"},{"title":"Offset-accurate substring search","prompt":"In the text 'The quick brown fox jumps', find the substring 'brown' starting from offset 4, counting by codepoint, and tell me where it starts."}],"resultDescription":"Returns the result of the requested operation: for insert/delete/replace, the modified text string; for extract, the extracted substring; for find, the starting offset of the match; for measure, the character count. All responses include the affected range reported in both the chosen unit (grapheme, codepoint, or UTF-16) and in UTF-16 units.","failureModes":["Offset out of bounds returns an error if start/end/index exceeds text length","Text exceeding 20,000 UTF-16 units is rejected","Value exceeding 5,000 UTF-16 units for insert/replace is rejected","Invalid op value returns a validation error","Missing required parameters for the chosen operation (e.g. missing start/end for delete) return errors","Invalid unit value returns a validation error"],"whenToPreferThis":"Choose this endpoint when you need to manipulate text at precise character-level offsets with correct Unicode semantics — especially when working with emoji, combining characters, or multilingual text where byte vs code-point vs grapheme distinctions matter. Prefer it over naive string-slicing code when you cannot risk splitting surrogate pairs or grapheme clusters, or when you need the affected range reported in both your chosen unit and UTF-16 for downstream compatibility.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T18:42:03.729Z","isFirstParty":false}