Experimental Physics and
| |||||||||||||||
|
Hi All, We tried Hugo's solution, but this only got the first character of the string for us so we used getLongArray instead and had to do some splitting to remove brackets and L's which were returned along with the int array. There may be a more elegant way to do it but the code as follows worked for us.Cheers, Isabella from org.csstudio.opibuilder.scriptUtil import PVUtil from org.csstudio.opibuilder.scriptUtil import ConsoleUtil #Get characters as Long Int array #This has form e.g. 'array('l',[70L,69L,45L])' sans quotes v = PVUtil.getLongArray(pvs[0]) #split array on starting square bracket '[' v = str(v).split("[") #if this is false it means '[' wasn't present if len(v)>1: # Select part after '[' v = v[1] #Cut off end of array marked by "]" v = v.split("]")[0] #Remove "L"'s from array (signifying long ints) v = v.replace("L","") #split string on commas into list v=v.split(",") #rejoin characters into string strArray = "".join(chr(int(i)) for i in v) On 13 March 2015 at 19:47, Hugo Slepicka <[email protected]> wrote:
| ||||||||||||||
ANJ, 16 Dec 2015 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |