ScriptSpot home

Forum topic · General Scripting

How to rename without white spaces in 3dmax objects

By johnsu6616 · 2018-05-04

New forum topics are on pause. Signed-in members can reply to existing topics. Contact ScriptSpot if you need help.

Description

May I ask if I want to remove all white space form objects name.
I am a beginner and don't know how to do.
and thanks for answer.

fn FindAndReplaceAll str fnd rpl =
(
local addpos, fndcount = fnd.count
while ((addpos = findString str fnd) != undefined) do ( str = replace str addpos fndCount rpl )
)
sel=objects as array
for str in sel do FindAndReplaceAll str.name " " ""

Comments (4)
fajar

using this String Parser

using this


String Parser Methods : isSpace " MAXScript" --first character is space
johnsu6616

.

thank you so much.
great example for me!
fix all object name without space and tab
and thanks again


sel=objects as array
for s in sel do
s.name = RemoveAllWhiteSpace s.name

Panteleev Sergey

.


fn RemoveAllWhiteSpace inputString = (

	local outputString = StringStream ""
	for x in filterString inputString " \t\r\n" do format "%" x to:outputString
	outputString as string

)

RemoveAllWhiteSpace " <- Space And Tab ->	"