Inputs
-
string
-
specific character
Outputs
Neuron type
Best algorithm has been found - locked
Patterns
Pattern |
Input |
Output |
1. |
string: |
abc, def |
specific character: |
, |
|
|
2. |
string: |
123-4 |
specific character: |
- |
|
|
3. |
string: |
abcdef |
specific character: |
& |
|
|
Applicable neurons
-
Substring (from start to position)
-
Substring (from position to end)
-
Get substring between string1 and string2
-
Get after substring
-
Get before substring
-
IF
-
character \
-
character >
-
character /
-
Rectangular cuboid - Surface Area
-
Get first letter
-
max (from 2 values)
-
character x
-
Time to deadline
Algorithm
Test
Code made by AI:
/**
* Position: Search position substring of string
*
* @param x1 MyString
* @param x2 FindMe
* @return {Array}
*/
function neuron523(x1, x2)
{
return [x1.toString().indexOf(x2.toString())];
}
/**
* 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)];
}
/**
* Get before substring:
*
* @param x1 MyString
* @param x2 Substring
* @return {Array}
*/
function neuron532(x1, x2)
{
var outputs = [];
outputs[0] = x1;
outputs[1] = x2;
arr = neuron523(outputs[0], outputs[1]);
outputs[2] = arr[0];
arr = neuron500();
outputs[3] = arr[0];
arr = neuron525(outputs[0], outputs[2], outputs[3]);
outputs[4] = arr[0];
return[outputs[4]];
}
/**
* IF: IF a THEN b ELSE c;
*
* @param x1 condition (1/0)
* @param x2 variable for 1
* @param x3 variable for 0
* @return {Array}
*/
function neuron579(x1, x2, x3)
{
return [(x1) ? x2 : x3];
}
/**
* Cut String At specific character:
*
* @param x1 string
* @param x2 specific character
* @return {Array}
*/
function neuron822(x1, x2)
{
var outputs = [];
outputs[0] = x1;
outputs[1] = x2;
arr = neuron532(outputs[0], outputs[1]);
outputs[2] = arr[0];
arr = neuron579(outputs[2], outputs[2], outputs[0]);
outputs[3] = arr[0];
return[outputs[3]];
}
Code made by AI: