delete character at the end of a sentence

Inputs

  • sentence
  • character

Outputs

  • sentence without character

Neuron type

Best algorithm has been found - locked

Patterns

Pattern Input Output
1.
sentence: Hello.
character: .
sentence without character: Hello
2.
sentence: Hello.
character: ?
sentence without character: Hello.
3.
sentence: Hello
character: .
sentence without character: Hello
4.
sentence: Deduction, reasoning, problem solving.
character: .
sentence without character: Deduction, reasoning, problem solving
5.
sentence: Go!
character: !
sentence without character: Go

Applicable neurons

  • IF
  • a = b
  • Get last character
  • Degrees into radians
  • Insert html to tag
  • Get html between tags (text)
  • ext from path
  • select sum (A, B, C)
  • character j

Algorithm

Test

Code made by AI:
/**
 * Length of string: 
 *
 * @param x1 String
 * @return {Array}
 */
function neuron528(x1)
{
return[x1.toString().length];
}

/**
 * 1: 
 *
 * @return {Array}
 */
function neuron501()
{
return [1];
}

/**
 * Minus (x - y): 
 *
 * @param x1 Number X
 * @param x2 Number Y
 * @return {Array}
 */
function neuron2(x1, x2)
{
math.config({number: 'BigNumber', precision: 64}); return [math.eval(Number(x1) + '-'+Number(x2)).toString()];
}

/**
 * x - 1: 
 * 
 * @param x1 x
 * @return {Array}
 */
function neuron595(x1)
{
  var outputs = [];
  outputs[0] = x1;

  arr = neuron501();
  outputs[1] = arr[0];

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

  return[outputs[2]];
}


/**
 * Length of string: 
 *
 * @param x1 String
 * @return {Array}
 */
function neuron528(x1)
{
return[x1.toString().length];
}

/**
 * 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 position to end): 
 * 
 * @param x1 MyString
 * @param x2 start position
 * @return {Array}
 */
function neuron529(x1, x2)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;

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

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

  return[outputs[3]];
}


/**
 * 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]];
}


/**
 * Get last character: 
 * 
 * @param x1 String
 * @return {Array}
 */
function neuron684(x1)
{
  var outputs = [];
  outputs[0] = x1;

  arr = neuron528(outputs[0]);
  outputs[1] = arr[0];

  arr = neuron595(outputs[1]);
  outputs[2] = arr[0];

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

  arr = neuron526(outputs[0], outputs[2]);
  outputs[4] = arr[0];

  return[outputs[3], outputs[4]];
}


/**
 * a = b: IF a=b THEN 1 ELSE 0;
 *
 * @param x1 a
 * @param x2 b
 * @return {Array}
 */
function neuron591(x1, x2)
{
return [(x1 == x2) ? 1 : 0];
}

/**
 * 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];
}

/**
 * delete character at the end of a sentence: 
 * 
 * @param x1 sentence
 * @param x2 character
 * @return {Array}
 */
function neuron707(x1, x2)
{
  var outputs = [];
  outputs[0] = x1;
  outputs[1] = x2;

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

;   outputs[3] = arr[1];

  arr = neuron591(outputs[2], outputs[1]);
  outputs[4] = arr[0];

  arr = neuron579(outputs[4], outputs[3], outputs[0]);
  outputs[5] = arr[0];

  return[outputs[5]];
}


Code made by AI:

Create your family tree for free