All Projects → sindresorhus → split-on-first

sindresorhus / split-on-first

Licence: MIT license
Split a string on the first occurrence of a given separator

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to split-on-first

Cracking The Coding Interview
Solutions for Cracking the Coding Interview - 6th Edition
Stars: ✭ 35 (-48.53%)
Mutual labels:  string, string-manipulation
Androidlibrary
Android library to reveal or obfuscate strings and assets at runtime
Stars: ✭ 162 (+138.24%)
Mutual labels:  string, string-manipulation
Litestringbuilder
Alternative to the System.Text.StringBuilder C# class.
Stars: ✭ 48 (-29.41%)
Mutual labels:  string, string-manipulation
Portable Utf8
🉑 Portable UTF-8 library - performance optimized (unicode) string functions for php.
Stars: ✭ 405 (+495.59%)
Mutual labels:  string, string-manipulation
Superstring.py
A fast and memory-optimized string library for heavy-text manipulation in Python
Stars: ✭ 231 (+239.71%)
Mutual labels:  string, string-manipulation
Stringplus
Funny and minimal string library for C++ inspired by underscore.string
Stars: ✭ 7 (-89.71%)
Mutual labels:  string, string-manipulation
Strtk
C++ String Toolkit Library
Stars: ✭ 113 (+66.18%)
Mutual labels:  string, string-manipulation
normalize-text
📝 Provides a simple API to normalize texts, whitespaces, paragraphs & diacritics.
Stars: ✭ 54 (-20.59%)
Mutual labels:  string, string-manipulation
Util
A collection of useful utility functions
Stars: ✭ 201 (+195.59%)
Mutual labels:  string, string-manipulation
Str
A fast, solid and strong typed string manipulation library with multibyte support
Stars: ✭ 199 (+192.65%)
Mutual labels:  string, string-manipulation
Tiny Utf8
Unicode (UTF-8) capable std::string
Stars: ✭ 322 (+373.53%)
Mutual labels:  string, string-manipulation
vbml
Way to check, match and resist.
Stars: ✭ 27 (-60.29%)
Mutual labels:  string, string-manipulation
safe-string-interpolation
A type driven approach to string interpolation, aiming at consistent, secure, and only-human-readable logs and console outputs !
Stars: ✭ 14 (-79.41%)
Mutual labels:  string, string-manipulation
Mightystring
Making Ruby Strings Powerful
Stars: ✭ 28 (-58.82%)
Mutual labels:  string, string-manipulation
stringext
Extra string functions for OCaml
Stars: ✭ 20 (-70.59%)
Mutual labels:  string, string-manipulation
Strman Java
A Java 8 string manipulation library.
Stars: ✭ 1,362 (+1902.94%)
Mutual labels:  string, string-manipulation
node-split-file
🌱 NodeJS Module to split and merge files for several purposes like transporting over unstable networks.
Stars: ✭ 33 (-51.47%)
Mutual labels:  split, npm-package
Voca rs
Voca_rs is the ultimate Rust string library inspired by Voca.js, string.py and Inflector, implemented as independent functions and on Foreign Types (String and str).
Stars: ✭ 167 (+145.59%)
Mutual labels:  string, string-manipulation
Pupa
Simple micro templating
Stars: ✭ 231 (+239.71%)
Mutual labels:  string, npm-package
node-red-contrib-string
Provides a string manipulation node with a chainable UI based on the concise and lightweight stringjs.com.
Stars: ✭ 15 (-77.94%)
Mutual labels:  string, string-manipulation

split-on-first

Split a string on the first occurrence of a given separator

This is similar to String#split(), but that one splits on all the occurrences, not just the first one.

Install

$ npm install split-on-first

Usage

import splitOnFirst from 'split-on-first';

splitOnFirst('a-b-c', '-');
//=> ['a', 'b-c']

splitOnFirst('key:value:value2', ':');
//=> ['key', 'value:value2']

splitOnFirst('a---b---c', '---');
//=> ['a', 'b---c']

splitOnFirst('a-b-c', '+');
//=> []

splitOnFirst('abc', '');
//=> []

API

splitOnFirst(string, separator)

string

Type: string

The string to split.

separator

Type: string

The separator to split on.

Related

  • split-at - Split a string at one or more indices
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].