Question: trimatoi.go github.com / 0 1 - edu / z 0 1 . PrintRune, - - allow - builtin Instructions Write a function that transforms numbers
trimatoi.go
github.comeduzPrintRune, allowbuiltin
Instructions
Write a function that transforms numbers within a string, into an int.
If the sign is encountered before any number it should determine the sign of the returned int.
This function should only return an int. In the case of an invalid input, the function should return
Note: There will never be more than one sign in a string in the tests.
Expected function
func TrimAtois string int
Usage
Here is a possible program to test your function :
package main
import
fmt
"piscine"
func main
fmtPrintlnpiscineTrimAtoi
fmtPrintlnpiscineTrimAtoistring
fmtPrintlnpiscineTrimAtoi
fmtPrintlnpiscineTrimAtoiHello World!"
fmtPrintlnpiscineTrimAtoisdxfaWs
fmtPrintlnpiscineTrimAtoisdxfaWs
fmtPrintlnpiscineTrimAtoisdxfaWs
fmtPrintlnpiscineTrimAtoisdxfaWs
And its output :
$ go run
$
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
