Boolean func returns boolean value of string value like on, off, 0, 1, yes, no returns boolean value of string input. You can chain this function on other function which returns implemented StringManipulation interface
()
| 99 | // returns boolean value of string input. You can chain this function on other function |
| 100 | // which returns implemented StringManipulation interface |
| 101 | func (i *input) Boolean() bool { |
| 102 | input := getInput(*i) |
| 103 | inputLower := strings.ToLower(input) |
| 104 | off := contains(False, inputLower) |
| 105 | if off { |
| 106 | return false |
| 107 | } |
| 108 | on := contains(True, inputLower) |
| 109 | if on { |
| 110 | return true |
| 111 | } |
| 112 | panic(errors.New(InvalidLogicalString)) |
| 113 | } |
| 114 | |
| 115 | // CamelCase is variadic function which takes one Param rule i.e slice of strings and it returns |
| 116 | // input type string in camel case form and rule helps to omit character you want to omit from string. |