總編程新手在這裏。在紅寶石中,我將如何去除下列非字母和非數字字符串,然後將字符串拆分爲數組,然後將其拆分爲空格。正則表達式用於分割非字母和非數字字符
例
string = "Honey - a sweet, sticky, yellow fluid made by bees and other insects from nectar collected from flowers."
進入這個
tokenized_string = ["Honey", "a", "sweet", "sticky", "yellow", "fluid", "made", "by", "bees", "and", "other", "insects", "from", "nectar", "collected", "from", "flowers"]
任何幫助,將不勝感激!
你應該告訴我們你嘗試,而不是問我們的代碼是什麼。 –