String Masks

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

String Masks

Martin Marris

Is there a way to force a format on a string?

 

I need to pad numbers from 1 to 999 so that they are returned as four-digit strings with padded zeros in front.

 

I wrote a quick routine to do this … but wondered whether I was reinventing the wheel.

 


_______________________________________________
Plugin-dev mailing list
[hidden email]
http://avid-listsrv1.avid.com/mailman/listinfo/plugin-dev
Reply | Threaded
Open this post in threaded view
|

Re: String Masks

Bob Zawalich

You can do this with utils.MakeNDigitNumber (x, nDigits)

 

But it is pretty easy to do yourself if you prefer.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Martin Marris
Sent: Sunday, October 04, 2015 3:12 PM
To: 'A mailing list for Sibelius plug-in developers'
Subject: [Plugin-dev] String Masks

 

Is there a way to force a format on a string?

 

I need to pad numbers from 1 to 999 so that they are returned as four-digit strings with padded zeros in front.

 

I wrote a quick routine to do this … but wondered whether I was reinventing the wheel.

 


_______________________________________________
Plugin-dev mailing list
[hidden email]
http://avid-listsrv1.avid.com/mailman/listinfo/plugin-dev
Reply | Threaded
Open this post in threaded view
|

Re: String Masks

Martin Marris

Thanks Bob.

 

It’s not in the manual! Which is why I hadn’t spotted it. But now that you point it out, I find it in the “utils” method. I didn’t realize there were some undocumented shipping “utils”….

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Bob Zawalich
Sent: Sunday, October 04, 2015 20:26
To: 'A mailing list for Sibelius plug-in developers'
Subject: Re: [Plugin-dev] String Masks

 

You can do this with utils.MakeNDigitNumber (x, nDigits)

 

But it is pretty easy to do yourself if you prefer.

 

From: [hidden email] [[hidden email]] On Behalf Of Martin Marris
Sent: Sunday, October 04, 2015 3:12 PM
To: 'A mailing list for Sibelius plug-in developers'
Subject: [Plugin-dev] String Masks

 

Is there a way to force a format on a string?

 

I need to pad numbers from 1 to 999 so that they are returned as four-digit strings with padded zeros in front.

 

I wrote a quick routine to do this … but wondered whether I was reinventing the wheel.

 


_______________________________________________
Plugin-dev mailing list
[hidden email]
http://avid-listsrv1.avid.com/mailman/listinfo/plugin-dev