| Vorheriges Thema anzeigen :: Nächstes Thema anzeigen   | 
	 
	
	
		| Autor | 
		Nachricht | 
	 
	
		Snow Administrator
  
  
  Anmeldedatum: 21.11.2000 Beiträge: 1946 Wohnort: Deiningen
  | 
		
			
				 Verfasst am: 28.04.2003 - 17:33    Titel: Programm: AppleScript - Funktion: suchen/ersetzen | 
				     | 
			 
			
				
  | 
			 
			
				Beschreibung: 
 
Um alle Vorkommen eines bestimmtes Zeichens oder einer Zeichenfolge in einem Text auf einen Rutsch durch ein anderes Zeichen/Zeichenfolge zu ersetzen, braucht man nicht unbedingt die Hilfe einer Scripting Addition. Allein mit AppleScript-Mitteln ist dies machbar.
 
 
 Code:
 
 
set myText to "Dieser Text möchte gern ohne ö's auskommen können."
 
set mySearch to "ö"
 
set myReplace to "oe"
 
 
textReplace(myText, mySearch, myReplace)
 
 
------------------------------------------------------------------------------
 
 
on textReplace(theText, srchStrng, replStrng)
 
 tell (a reference to AppleScript's text item delimiters)
 
  set { od, contents } to { contents, { srchStrng } }
 
  try
 
   set { textList, contents } to { (text items of theText), { replStrng } }
 
   set { newText, contents } to { (textList as text), od }
 
   return item 1 of result
 
  on error errMsg number errNbr
 
   set contents to od
 
   error errMsg number errNbr
 
  end try
 
 end tell
 
end textReplace
 
 
 
Anmerkung: Der 'textReplace'-Handler stammt in dieser Form von Marc K. Myers. Er ist zwar nicht besonders leicht zu verstehen, dafür ist der Code jedoch recht kompakt und effizient. _________________ Peter
 
-
 
Fischer-Bayern.de|Shadetreemicro.com
  Zuletzt bearbeitet von Snow am 07.05.2005 - 12:09, insgesamt einmal bearbeitet | 
			 
		  | 
	 
	
		| Nach oben | 
		 | 
	 
	
		  | 
	 
	
		Armin Egginger •-->
  
  
  Anmeldedatum: 04.05.2002 Beiträge: 96 Wohnort: Germering (b. München)
  | 
		
			
				 Verfasst am: 10.05.2003 - 16:14    Titel: Eine weitere Möglichkeit | 
				     | 
			 
			
				
  | 
			 
			
				Hi Scripter,
 
 
ich hab hier mal andere Möglichkeiten, die Buchstaben auszutauschen. 
 
 
Dieses Script tauscht die einzelnen Buchstaben  
 
 - im ASCII Code gekennzeichnet oder  
 
 - als direkter Buchstabe gekennzeichnet 
 
 gegen einen eingestellten Buchstaben aus. Der erste Teil ist mit Schleife, so daß auch gleich mehrere Buchstaben ausgetauscht werden. Der Handler ist auch bei mehreren Aufrufen in verschiedenen Stellen des Skripts sinnvoll.  
 
 
 Code: 
 
 
set xEmail to "DerTester <info@derTester.de>"
 
-- 62, 60, 64 sind die größer/kleiner und das @ Zeichen
 
set charList to {62, 60, 64}
 
-- 32, 32, 45 sind Leerzeichen und Bindestrich
 
set cList to {32, 32, 45}
 
repeat with n from 1 to (count every item in charList)
 
   set prevTID to AppleScript's text item delimiters
 
   set AppleScript's text item delimiters to ASCII character (item n of charList)
 
   set xEmail to text items of xEmail
 
   set AppleScript's text item delimiters to ASCII character (item n of cList)
 
   set xEmail to xEmail as text
 
   set AppleScript's text item delimiters to prevTID
 
end repeat
 
display dialog xEmail
 
 
 
-- oder als Handler
 
 
set xtex to "Ein Text, bei dem das -@- getauscht werden soll!"
 
set xChar to "@"
 
set xCharRepl to "at"
 
set xtex to TIDsearchReplace(xtex, xChar, xCharRepl) of me
 
display dialog xtex
 
 
on TIDsearchReplace(xtex, xChar, xCharRepl)
 
   set oldTID to AppleScript's text item delimiters
 
   set AppleScript's text item delimiters to xChar
 
   set xtex to text items of xtex
 
   set AppleScript's text item delimiters to xCharRepl
 
   set xtex to xtex as text
 
   set AppleScript's text item delimiters to oldTID
 
   return xtex
 
end TIDsearchReplace
 
 
 
Viel Spaß
 
 
Armin | 
			 
		  | 
	 
	
		| Nach oben | 
		 | 
	 
	
		  | 
	 
	
		ecco •->
  
 
  Anmeldedatum: 05.11.2001 Beiträge: 9
 
  | 
		
			
				 Verfasst am: 31.03.2004 - 23:43    Titel:  | 
				     | 
			 
			
				
  | 
			 
			
				hier noch meine version dazu:
 
 
 	  | Code: | 	 		  
 
on strReplace(source, findit, replaceit)
 
   set oldDelimiters to text item delimiters
 
   set text item delimiters to findit
 
   set output_list to {}
 
   repeat with i from 1 to count of text items of source
 
      set output_list to output_list & (text item i of source)
 
   end repeat
 
   set text item delimiters to replaceit
 
   set output to output_list as string
 
   set text item delimiters to oldDelimiters
 
   return output
 
end strReplace
 
 | 	  
 
 
und so sieht dann der aufruf aus:
 
 
 	  | Code: | 	 		  
 
strReplace("Hallo Fischer-Baden", "Baden", "Bayern")
 
return the result
 
-- result: "Hallo Fischer-Bayern"
 
 | 	  
 
 
ciao
 
ecco | 
			 
		  | 
	 
	
		| Nach oben | 
		 | 
	 
	
		  | 
	 
	
		Heiner •-->
  
 
  Anmeldedatum: 03.12.2005 Beiträge: 62 Wohnort: Moers
  | 
		
			
				 Verfasst am: 31.01.2006 - 22:28    Titel:  | 
				     | 
			 
			
				
  | 
			 
			
				Zum besseren Verständnis von Snows Version vom 28.4.2003 (s.o.) habe ich hier einmal die einzelnen Zwischenergebnisse eingesetzt. (Gilt nur für die weniger Geübten, wie mich)
 
 
 
set myText to "Dieser Text möchte gern ohne ö's auskommen können."
 
set mySearch to "ö"
 
set myReplace to "oe"
 
 
textReplace(myText, mySearch, myReplace)
 
 
------------------------------------------------------------------------------ 
 
 
on textReplace(theText, srchStrng, replStrng)
 
	tell (a reference to AppleScript's text item delimiters)
 
		set {od, contents} to {contents, {srchStrng}}
 
		-- Ergebnis: {{" "},{"ö"}}
 
		try
 
			set {textList, contents} to {(text items of theText), {replStrng}}
 
			-- Ergebnis: {{"Dieser Text m", "chte gern ohne", "'s auskommen k", "nnen."}, {"oe"}}
 
			set {newText, contents} to {(textList as text), od}
 
			-- Ergebnis: {"Dieser Text moechte gern ohne oe's auskommen koennen.", {"oe"}}
 
			return item 1 of result
 
			-- Ergebnis: "Dieser Text moechte gern ohne oe's auskommen koennen."
 
		on error errMsg number errNbr
 
			set contents to od
 
			-- Ergebnis: {"oe"}
 
			error errMsg number errNbr
 
		end try
 
	end tell
 
end textReplace
 
 
Heiner | 
			 
		  | 
	 
	
		| Nach oben | 
		 | 
	 
	
		  | 
	 
	
		FrankJScott Gast
 
 
 
 
 
  | 
		
			
				 Verfasst am: 15.12.2022 - 21:09    Titel: High Rated Indoor Air Quality Services Tips | 
				     | 
			 
			
				
  | 
			 
			
				| for the people talking about lennox repair near me, emergency gas engineer, gas heater service near me, ductless ac installation near me, br plumbing and heating, four seasons plumbing and heating,  I highly suggest this excellent indoor air quality services site or local hvac repair, at your service heating and cooling, may heating and air, bob's heating and cooling, casteel heating and air, furnace maintenance near me, and don't forget this best indoor air quality services info not to mention star heating and cooling, day heating, northwind heating, geothermal heating system, gas furnace replacement, new boiler installation, alongside all this top indoor air quality services tips which is also great. also have a look at this new cooling services site on top of heating system repair, plumbing heating and cooling near me, precise heating, pro heating, heating and ventilation, central heating engineers near me, as well as this great indoor air quality services details and don't forget ac heating and air, air pro heating and cooling, gunthers heating and air, hvac and plumbing, furnace repair company, local boiler repair, alongside all recommended indoor air quality services blog which is also worth a look. i also recommend this updated indoor air quality services link and don't forget geothermal heating and cooling system, heating and air conditioning companies near me, barlow heating and air, heater repair near me, ductless heating system, 1st choice heating and air, as well as this best indoor air quality services info as well as flushing central heating system, elite heating and cooling, heating and air conditioning companies, air source heat pump servicing near me, armstrong heating and cooling, home comfort heating, on top of top rated heating services details as well as precise heating, hvac replacement, complete comfort heating and cooling, 24 hour ac repair near me, furnace maintenance near me, ductless heating and cooling units, which is also great. finally, have a look at this updated heating services tips with gas heater repair, heating and cooling solutions, bardi heating and air, hvac contractors, hvac replacement, hvac repair,  for good measure. | 
			 
		  | 
	 
	
		| Nach oben | 
		 | 
	 
	
		  | 
	 
	
		dqapoinbg660 •--->
  
 
  Anmeldedatum: 12.12.2022 Beiträge: 449 Wohnort: New York city
  | 
		 | 
	 
	
		| Nach oben | 
		 | 
	 
	
		  | 
	 
	
		dqapoinbg660 •--->
  
 
  Anmeldedatum: 12.12.2022 Beiträge: 449 Wohnort: New York city
  | 
		 | 
	 
	
		| Nach oben | 
		 | 
	 
	
		  | 
	 
	
		dqapoinbg660 •--->
  
 
  Anmeldedatum: 12.12.2022 Beiträge: 449 Wohnort: New York city
  | 
		 | 
	 
	
		| Nach oben | 
		 | 
	 
	
		  | 
	 
	
		jiuer7845 •---->
  
 
  Anmeldedatum: 06.04.2021 Beiträge: 521
 
  | 
		 | 
	 
	
		| Nach oben | 
		 | 
	 
	
		  | 
	 
	
		FrankJScott Gast
 
 
 
 
 
  | 
		
			
				 Verfasst am: 20.12.2022 - 19:44    Titel: Awesome Marketing Agency Advice | 
				     | 
			 
			
				
  | 
			 
			
				| In response to the people inquiring about pr agency advertising agency, search advertising company, bwd advertising, b2b advertising agency, advertising partner, quality consulting,  I highly suggest this updated business seo services info or dpm advertising agency, creative digital advertising, strategic branding agency, public consulting, sustainable creative agency, marketing strategy consulting, as well as this best seo optimization services advice on top of tv advertising company, web design outsourcing, advertising agency services, ppc marketing service, reckitt benckiser media agency, birmingham advertising agency, alongside all this top rated strategic branding agency blog which is also great. also have a look at this new lawyer seo services site and don't forget aerospace consulting, biggest advertising agencies, web advertising agency, ad age a list 2020, web design for marketing, dental advertising firm, on top of this recommended content marketing specialist site not to mention google advertising company, amazon advertising campaigns, automotive marketing agency, affiliate marketing agency, global creative agency, marketing & advertising agency, not to mention new content marketing consultant url which is also worth a look. i also recommend this great basic video production tips and don't forget branding agency, branding digital agency, oil and gas consulting firms, my brand agency, list of advertising agencies, international ad agency, on top of this top rated digital branding agency url as well as search advertising company, leo burnett advertising agency, digital marketing ad agency, dentistry web design, y&r advertising, roofing web design, alongside all awesome ux web design url as well as digital marketing consulting services, atheneum consulting, attorneys web design, direct response advertising agency, google ads management services, ernst and young consulting, which is also great. finally, have a look at this excellent google marketing consulting companies tips with human capital consulting, digital marketing services, e commerce advertising agency, human resources consulting, kanda consulting, anomaly advertising agency,  for good measure. | 
			 
		  | 
	 
	
		| Nach oben | 
		 | 
	 
	
		  | 
	 
	
		dqapoinbg660 •--->
  
 
  Anmeldedatum: 12.12.2022 Beiträge: 449 Wohnort: New York city
  | 
		 | 
	 
	
		| Nach oben | 
		 | 
	 
	
		  | 
	 
	
		dqapoinbg660 •--->
  
 
  Anmeldedatum: 12.12.2022 Beiträge: 449 Wohnort: New York city
  | 
		 | 
	 
	
		| Nach oben | 
		 | 
	 
	
		  | 
	 
	
		dqapoinbg660 •--->
  
 
  Anmeldedatum: 12.12.2022 Beiträge: 449 Wohnort: New York city
  | 
		 | 
	 
	
		| Nach oben | 
		 | 
	 
	
		  | 
	 
	
		dqapoinbg660 •--->
  
 
  Anmeldedatum: 12.12.2022 Beiträge: 449 Wohnort: New York city
  | 
		 | 
	 
	
		| Nach oben | 
		 | 
	 
	
		  | 
	 
	
		dqapoinbg660 •--->
  
 
  Anmeldedatum: 12.12.2022 Beiträge: 449 Wohnort: New York city
  | 
		 | 
	 
	
		| Nach oben | 
		 | 
	 
	
		  | 
	 
	
		 | 
	 
 
  
	 
	    
	   | 
	
Du kannst keine Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum nicht antworten. Du kannst deine Beiträge in diesem Forum nicht bearbeiten. Du kannst deine Beiträge in diesem Forum nicht löschen. Du kannst an Umfragen in diesem Forum nicht mitmachen.
  | 
   
 
  
Powered by phpBB  © 2001, 2002 phpBB Group Deutsche Übersetzung von phpBB.de 
		 | 
	 
 
 | 
 
 |