This happened to Bayard Rustin, the civil rights and peace activist, back in the 70s. He was arrested in Time Square for carrying a sword in his cane. He was a noted cane collector, but had no idea there was a sword in that cane.
Also, every gentleman was expected to carry a cane with him as a fashion accessory, at least during the early 19th century. There was a whole calling custom of keeping one’s hat and cane for short calls, but giving them to the butler for a longer call.
Sword canes were never very common, but they could be useful for self defense in a place where guns were uncommon. Sherlock Holmes carried a cane hollowed and filled with a heavy metal core, a Penang lawyer, as they called it back then.