An interactive, comprehensive guide to JavaScript string manipulation methods with live code playground
- 40+ JavaScript string methods organized by category
- Search & Test:
charAt
,includes
,indexOf
,match
,search
, and more - Transform:
toLowerCase
,toUpperCase
,trim
,normalize
, and more - Extract:
slice
,substring
,split
,substr
, and more - Modify:
concat
,replace
,padStart
,repeat
, and more - Creation: Static methods like
String.fromCharCode
,String.raw
- Live code editor with syntax highlighting
- Real-time execution with instant feedback
- Copy & run functionality for easy experimentation
- Error handling with clear error messages
- Output visualization for better understanding
- Dark/Light theme support with smooth transitions
- Responsive design that works on all devices
- Beautiful animations and hover effects
- Intuitive navigation with categorized method lists
- Search functionality to quickly find methods
- Multi-language support infrastructure
- Currently supports English with easy expansion
- Context-aware translations for all UI elements
- Node.js 18+
- npm, yarn, or pnpm
# Clone the repository
git clone https://github.com/DevTwitter/js-string-methods.git
# Navigate to the project directory
cd js-string-methods
# Install dependencies
npm install
# or
yarn install
# or
pnpm install
# Start the development server
npm run dev
# or
yarn dev
# or
pnpm dev
Open http://localhost:3000 in your browser to see the application.
js-string-methods/
├── app/ # Next.js app directory
│ ├── layout.tsx # Root layout component
│ └── page.tsx # Home page
├── components/ # React components
│ ├── ui/ # Reusable UI components
│ │ ├── button.tsx
│ │ ├── card.tsx
│ │ ├── input.tsx
│ │ └── ...
│ ├── code-playground.tsx # Interactive code editor
│ ├── string-methods-explorer.tsx # Main explorer component
│ └── theme-toggle.tsx # Theme switcher
├── lib/ # Utility libraries
│ ├── i18n/ # Internationalization
│ │ ├── config.ts
│ │ ├── context.tsx
│ │ └── translations/
│ └── string-methods.ts # String methods data
├── styles/ # Global styles
│ ├── globals.css
│ └── highlight.css
└── public/ # Static assets
- Next.js 15.2.4 - React framework with App Router
- React 19 - UI library
- TypeScript 5 - Type safety
- Tailwind CSS 3.4.17 - Styling
- Radix UI - Accessible component primitives
- Lucide React - Beautiful icons
- Class Variance Authority - Component variant management
- Highlight.js - Syntax highlighting
- react-simple-code-editor - Code editor component
- ESLint - Code linting
- PostCSS - CSS processing
- next-themes - Theme management
Methods for searching and testing string content:
charAt()
- Get character at specific indexcharCodeAt()
- Get Unicode value of charactercodePointAt()
- Get code point valueat()
- Get character with negative index supportincludes()
- Check if string contains substringindexOf()
- Find first occurrence indexlastIndexOf()
- Find last occurrence indexstartsWith()
- Check if string starts with substringendsWith()
- Check if string ends with substringmatch()
- Match against regular expressionmatchAll()
- Get all regex matchessearch()
- Search for regex pattern
Methods for transforming string format and appearance:
toLowerCase()
- Convert to lowercasetoLocaleLowerCase()
- Locale-aware lowercasetoUpperCase()
- Convert to uppercasetoLocaleUpperCase()
- Locale-aware uppercasetrim()
- Remove whitespace from both endstrimStart()
- Remove leading whitespacetrimEnd()
- Remove trailing whitespacenormalize()
- Unicode normalization
Methods for extracting parts of strings:
slice()
- Extract substring by indicessubstring()
- Extract substring between indicessubstr()
- Extract substring from positionsplit()
- Split string into array
Methods for modifying and combining strings:
concat()
- Concatenate stringsreplace()
- Replace first occurrencereplaceAll()
- Replace all occurrencespadStart()
- Pad string at startpadEnd()
- Pad string at endrepeat()
- Repeat string multiple times
Static methods for creating strings:
String.fromCharCode()
- Create from character codesString.fromCodePoint()
- Create from code pointsString.raw()
- Raw template literal
- Browse Methods: Use the categorized sidebar to explore different string methods
- Search: Type in the search box to quickly find specific methods
- Learn: Read syntax, examples, and descriptions for each method
- Experiment: Use the code playground to modify examples and see results
- Practice: Copy code snippets and run them in your own environment
- Syntax Highlighting: JavaScript code is highlighted for better readability
- Live Execution: Click "Run" to execute code and see output
- Error Handling: Clear error messages help debug issues
- Copy Functionality: Easy copying of code examples
- Real-time filtering as you type
- Case-insensitive search
- Category-based organization
- No results state with helpful suggestions
- Mobile-first approach
- Adaptive layouts for different screen sizes
- Touch-friendly interface elements
- Optimized for both desktop and mobile
- Keyboard navigation support
- Screen reader friendly
- High contrast mode support
- Focus management for better UX
- Code splitting for faster loading
- Optimized bundle size
- Lazy loading of components
- Efficient re-renders
We welcome contributions! Here's how you can help:
- Use the GitHub issue tracker
- Provide clear reproduction steps
- Include browser and OS information
- Open an issue with the "enhancement" label
- Describe the feature and its benefits
- Consider implementation complexity
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Add method data to
lib/string-methods.ts
- Include syntax, example, and expected result
- Add description to
lib/i18n/translations/en.ts
- Test in the playground
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- JavaScript Community - For the amazing string methods
- MDN Web Docs - For comprehensive documentation
- Next.js Team - For the excellent framework
- Radix UI - For accessible components
- Tailwind CSS - For the utility-first CSS framework
Check out our companion project for JavaScript string manipulation:
If you find this dataset useful or enjoy the content from the DevTwitter channel, please consider supporting us:
Your support helps us maintain the channel and continue sharing valuable programming content with the community.
- GitHub Issues: Report bugs or request features
- Discussions: Join the community
- Contact: DevTwitter
⭐ Star this repository if you found it helpful!
Made with ❤️ by DevTwitter