Substring (from start to position)

Inputs

  • String
  • End position

Outputs

  • Substring

Neuron type

Best algorithm has been found - locked

Patterns

Pattern Input Output
1.
String: abcdef
End position: 2
Substring: ab
2.
String: long string
End position: 6
Substring: long s
3.
String: 222222222
End position: 3
Substring: 222
4.
String: 00000000
End position: 3
Substring: 000

Applicable neurons

  • 0
  • Substring (startPosition, endPosition)
  • NOR
  • discriminant b² - 4ac
  • Average
  • get year from date (yyyy-mm-dd)
  • get seconds from time (hh:mm:ss)

Algorithm

Test

Code made by AI:
/**
 * 0: 
 *
 * @return {Array}
 */
function neuron500()
{
return [0];
}

/**
 * Substring (startPosition, endPosition): Get substring from string - from position - to pos
 *
 * @param x1 MyString
 * @param x2 start position
 * @param x3 end position
 * @return {Array}
 */
function neuron525(x1, x2, x3)
{
return[x1.toString().substring(x2, x3)];
}

/**
 * Substring (from start to position): 
 * 
 * @param x1 String
 * @param x2 End position
 * @return {Array}
 */
function neuron526(x1, x2)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;

  arr = neuron500();
  outputs[2] = arr[0];

  arr = neuron525(outputs[0], outputs[1], outputs[2]);
  outputs[3] = arr[0];

  return[outputs[3]];
}


Code made by AI:

Rodokmen - poznejte své předky | TOPlist U.I., Umělá inteligence