Skip to main content
Glama
StringExtensions.swift405 B
import Foundation // MARK: - String Extensions extension String { /// Truncates a string to the specified length, adding ellipsis if needed func truncated(to length: Int) -> String { // Truncates a string to the specified length, adding ellipsis if needed if self.count <= length { return self } return String(self.prefix(length - 3)) + "..." } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/steipete/Peekaboo'

If you have feedback or need assistance with the MCP directory API, please join our Discord server