[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Apr 3 17:20:39 1995 
Subject:converting phone numbers 
From:A . Sloman 
Volume-ID:950404.01 

Here's a little program ENTER fixphones for converting UK phone
numbers to the numbers required from 16th April.

People who use fixed format files of information can
do it more easily than this. But if like me you use a variety of
formats, sometimes even in the same file, you may find this useful.

It handles the conversions for Leeds, Sheffield, Nottingham,
Leicester and Bristol specially.

Documentation after the file header.

Aaron


/* --- The University of Birmingham 1995.  --------------------------------
 > File:            $poplocal/local/auto/ved_fixphones.p
 > Purpose:			Change phone codes
 > Author:          Aaron Sloman, Apr  3 1995
 > Documentation:	Below
 > Related Files:
 */
/*

ENTER fixphones
	Uses VED's interactive search and replace to change
	dialling codes for Leeds, Sheffield, Nottingham, Leicester and Bristol
	And also replaces 010 with 00

ENTER fixphones g
	Does the above globally, without requesting confirmation.

ENTER fixphones b
	Does it interactively for Birmingham
ENTER fixphones bg
	Does it globally for Birmingham

ENTER fixphones l
	Does it interactively for London
ENTER fixphones lg
	Does it globally for London

ENTER fixphones <digits>
	Interactively replaces occurrences of 0<digits> with 01<digits>
	E.g. for Edinburgh
		ENTER fixphones 31


For information on search and replace options available in VED
see TEACH VEDSEARCH/'search and substitute'
	
*/

define lconstant add_1(string);
	lvars string;
	veddo('s/0'<> string <> ' /01' <> string <> ' ');
	veddo('s/0'<> string <> '-/01' <> string <> '-');
enddefine;

define lconstant add_1_global(string);
	lvars string;
	veddo('sgs/0'<> string <> ' /01' <> string <> ' ');
	veddo('sgs/0'<> string <> '-/01' <> string <> '-');
enddefine;


define ved_fixphones();
	if vedargument = 'l' then
		add_1('71');
		add_1('81');
	elseif vedargument = 'lg' or vedargument = 'gl' then
		add_1_global('71');
		add_1_global('81');
	elseif vedargument = 'b' then
		add_1('21');
	elseif vedargument = 'bg' or vedargument = 'gb' then
		add_1_global('21');
	elseif strnumber(vedargument) then
		add_1(vedargument)
	elseif vedargument = 'g' then
    ;;; Leeds
    	veddo('sgs/0532-/0113-2/');
    	veddo('sgs/0532 /0113 2/');
    	;;; Sheffield
    	veddo('sgs/0742-/0114-2/');
    	veddo('sgs/0742 /0114 2/');
    	;;; Nottingham
    	veddo('sgs/0602-/0115-9/');
    	veddo('sgs/0602 /0115 9/');
    	;;; Leicester
    	veddo('sgs/0533-/0116-2/');
    	veddo('sgs/0533 /0116 2/');
    	;;; Bristol
    	veddo('sgs/0272-/0117-9/');
    	veddo('sgs/0272 /0117 9/');
		veddo('sgs/010-/00-/');
		veddo('sgs/010 /00 /');
	 else
		;;; Leeds
    	veddo('s/0532-/0113-2/');
    	veddo('s/0532 /0113 2/');
    	;;; Sheffield
    	veddo('s/0742-/0114-2/');
    	veddo('s/0742 /0114 2/');
    	;;; Nottingham
    	veddo('s/0602-/0115-9/');
    	veddo('s/0602 /0115 9/');
    	;;; Leicester
    	veddo('s/0533-/0116-2/');
    	veddo('s/0533 /0116 2/');
    	;;; Bristol
    	veddo('s/0272-/0117-9/');
    	veddo('s/0272 /0117 9/');
		veddo('s/010-/00-/');
		veddo('s/010 /00 /');
	endif
enddefine;