I want to create a small bot to sort out string variables that contain numbers in it. Please, can you point out how to make this bot work?
Thanks
I want to create a small bot to sort out string variables that contain numbers in it. Please, can you point out how to make this bot work?
Thanks
Hi
You can use below python code and use it into python commands. Function will be “sort_numbers_in_string” input you can pass the string variable which needs to be sorted and output need to be a string variable which gives out the output.
Remember this would require python installation on the machine where the bot will be running.
import re
def sort_numbers_in_string(input_string):
# Find all numbers in the input string using regular expression
numbers_list = re.findall(r'\d+', input_string)
# Convert the matched numbers from strings to integers and sort them
sorted_numbers = sorted(map(int, numbers_list))
return sorted_numbers
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.