split-on-first

WebJar for split-on-first

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

split-on-first
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

split-on-first
WebJar for split-on-first
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/sindresorhus/split-on-first

Download split-on-first

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/split-on-first/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>split-on-first</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/split-on-first/
implementation 'org.webjars.npm:split-on-first:1.1.0'
// https://jarcasting.com/artifacts/org.webjars.npm/split-on-first/
implementation ("org.webjars.npm:split-on-first:1.1.0")
'org.webjars.npm:split-on-first:jar:1.1.0'
<dependency org="org.webjars.npm" name="split-on-first" rev="1.1.0">
  <artifact name="split-on-first" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='split-on-first', version='1.1.0')
)
libraryDependencies += "org.webjars.npm" % "split-on-first" % "1.1.0"
[org.webjars.npm/split-on-first "1.1.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

split-on-first Build Status

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

const splitOnFirst = require('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

Versions

Version
1.1.0
1.0.0