module SchemeStrings
Scheme numbers module
Public Instance Methods
strcontains(other)
click to toggle source
# File lib/lisp/interpreter/core/strings.rb, line 91 def strcontains(other) arg_function_validator other, 2 result = other[0][1..-2].include? other[1][1..-2] result ? TRUE : FALSE end
strdowncase(other)
click to toggle source
# File lib/lisp/interpreter/core/strings.rb, line 86 def strdowncase(other) arg_function_validator other other[0].downcase end
string?(other)
click to toggle source
# File lib/lisp/interpreter/core/strings.rb, line 71 def string?(other) raise arg_err_build 1, other.size if other.size != 1 other[0].string? ? TRUE : FALSE end
strjoin(other)
click to toggle source
# File lib/lisp/interpreter/core/strings.rb, line 130 def strjoin(other) strjoin_validate other arg_function_validator [other[1]] if other.size == 2 string_join_helper other[0], other[1] end
strlen(other)
click to toggle source
# File lib/lisp/interpreter/core/strings.rb, line 76 def strlen(other) arg_function_validator other other[0][1..-2].length end
strlist(other)
click to toggle source
# File lib/lisp/interpreter/core/strings.rb, line 104 def strlist(other) arg_function_validator other result = other[0][1..-2].chars.map(&:to_char) build_list result end
strprefix(other)
click to toggle source
# File lib/lisp/interpreter/core/strings.rb, line 116 def strprefix(other) arg_function_validator other, 2 str, to_check = other.map { |t| t[1..-2] } result = str.start_with? to_check result ? TRUE : FALSE end
strreplace(other)
click to toggle source
# File lib/lisp/interpreter/core/strings.rb, line 110 def strreplace(other) arg_function_validator other, 3 str, to_replace, replace_with = other.map { |t| t[1..-2] } '"' + (str.gsub to_replace, replace_with) + '"' end
strsplit(other)
click to toggle source
# File lib/lisp/interpreter/core/strings.rb, line 97 def strsplit(other) arg_function_validator other str = remove_carriage other[0] result = str.split(' ').map { |s| '"' + s + '"' } build_list result end
strsufix(other)
click to toggle source
# File lib/lisp/interpreter/core/strings.rb, line 123 def strsufix(other) arg_function_validator other, 2 str, to_check = other.map { |t| t[1..-2] } result = str.end_with? to_check result ? TRUE : FALSE end
strupcase(other)
click to toggle source
# File lib/lisp/interpreter/core/strings.rb, line 81 def strupcase(other) arg_function_validator other other[0].upcase end
substring(other)
click to toggle source
# File lib/lisp/interpreter/core/strings.rb, line 63 def substring(other) raise arg_err_build '[2, 3]', other.size unless other.size.between? 2, 3 str, from, to = other arg_function_validator [str] substring_validator from, to substring_builder str, from.to_num, to.to_num end