logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
jgthweatt  
#1 Posted : Saturday, February 27, 2021 12:04:51 AM(UTC)
jgthweatt

Rank: Newbie

Groups: Registered
Joined: 5/18/2020(UTC)
Posts: 6
United States
Location: Maryland

I'm trying to remove leading zeros from a string variable.

3 instead of 003

I can't seem to understand how to get from a string functions I can find searching for VB.Net string functions like

Mid(String, Int32)

into the format needed in vmix script like

activeinputname.Substring(V_position,2)

I believe it has something to do with methods but those far I haven't figured it out.
Is there a resource available which shows the methods available in vmix scripting.
They seem similar to Javascript but not exactly

One idea I thought of was to convert string to integer and then back to string to strip leading zeros, but I couldn't find correct syntax for that.

Thanks in advance for any assistance.

Jim
xaver  
#2 Posted : Saturday, February 27, 2021 12:27:42 AM(UTC)
xaver

Rank: Advanced Member

Groups: Registered
Joined: 11/11/2016(UTC)
Posts: 378
Man
Location: Europe

Thanks: 23 times
Was thanked: 38 time(s) in 32 post(s)
in VB
cstr(val("003"))
will return "3"
jgthweatt  
#3 Posted : Saturday, February 27, 2021 3:17:41 AM(UTC)
jgthweatt

Rank: Newbie

Groups: Registered
Joined: 5/18/2020(UTC)
Posts: 6
United States
Location: Maryland

I'm sorry but I don't understand how to script with that command.

test = cstr(val("003"))

doesn't work with error message "val" is not declared.
This is the same issue I have with other string manipulation commands.

What would be the syntax in vmix scripting to set string variable test to the string variable value without leading zeros

Thanks
xaver  
#4 Posted : Saturday, February 27, 2021 3:30:34 AM(UTC)
xaver

Rank: Advanced Member

Groups: Registered
Joined: 11/11/2016(UTC)
Posts: 378
Man
Location: Europe

Thanks: 23 times
Was thanked: 38 time(s) in 32 post(s)
sorry
vMix needs cint() instead of val()

Dim Text as string
Text ="003"
Console.WriteLine (Text)
Dim I as integer
I = cint(Text)
Text = cstr(I)
Console.WriteLine (Text)


See also
https://forums.vmix.com/...86-Scripting-for-Dummies
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.