Git Product home page Git Product logo

ndarray-string's Introduction

ndarray-string

Turns a string into an ndarray

build status

Example

Conversion

var ndstring = require("ndarray-string")
var x = ndstring("foobar", [2,3])
console.log(ndstring.toString(x))

["foo", "bar"]

Rotations

We can also do fancier stuff. For example, here are all rotations of "banana"

var y = ndstring("bananabanana", [6,6], [1,1])
console.log(ndstring.toString(y))

Output

[ 'banana', 'ananab', 'nanaba', 'anaban', 'nabana', 'abanan' ]

Install

Install using npm:

npm install ndarray-string

API

var ndstring = require("ndarray-string")

ndstring(str[, shape, stride, offset])

Constructs an ndarray view of str. The values of the ndarray are the full unicode code points of str. The resulting ndarray is a view of a 32 bit unsigned int typed array.

  • str is the string which gets turned into an ndarray
  • shape is the shape of the resulting ndarray
  • stride is the stride of the ndarray
  • offset is the offset

Returns An ndarray view of the code points of str

ndstring.toString(arr)

Turns an ndarray view of a string into an array of strings.

  • arr is an ndarray view of a string, for example created using the above method

Returns An array of native arrays of strings, with the strings corresponding to the last dimension of the input array (so if the input has only one dimension, only a string is returned).

License

(c) 2013 Mikola Lysenko. MIT License

ndarray-string's People

Contributors

mikolalysenko avatar jaspervdg avatar

Stargazers

 avatar Emily Marigold Klassen avatar Michael Anthony avatar Hugh Kennedy avatar Kyle Robinson Young avatar

Watchers

 avatar Dmitry Iv. avatar James Cloos avatar Michael Anthony avatar Athan avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.