Using the Function Editor to replace special characters

المشرف العام

Administrator
طاقم الإدارة
I am attempting to use the new Function Editor within QGIS 2.8.2. I have a field called LAND_NAME with hundreds of rows. What I'm trying to do is find and replace all "special characters". In ArcGIS, I would use this function:

codeblock:

def findreplace(s):s = s.replace('(', '').replace(')','').replace('&','and').replace('\'','~').replace('.','').replace(' ','_').replace('@','at').replace(',','').replace('/','_').replace('[','').replace(']','').replace(':','_') return sIn the function editor, I have gotten this far and am now stuck:

@qgsfunction(args='auto', group='Custom')def findreplace(s):s = replace("field",'(','')return sAny insights into how to replace all the special characters in the first codeblock and make a function in QGIS?

Thanks!!!



أكثر...
 
أعلى